| @@ -100,9 +100,9 @@ | ||
| 100 | 100 | * @param array<string,mixed> $rule Rule to test. |
| 101 | 101 | * @return boolean |
| 102 | 102 | */ |
| 103 | 103 | public function is_rule_valid( $rule ) { |
| 104 | - return ! empty( $rule ); | |
| 104 | + return is_array( $rule ) && ! empty( $rule ); | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Get array of all registered rules. |
| @@ -478,9 +478,8 @@ | ||
| 478 | 478 | * Allow filtering post type rules. |
| 479 | 479 | * |
| 480 | 480 | * @param array<string,array<string,mixed>> $type_rules Post type rules. |
| 481 | 481 | * @param string $name Post type name. |
| 482 | - * @param \WP_Post_Type $post_type Post type object. | |
| 483 | 482 | * |
| 484 | 483 | * @return array<string,array<string,mixed>> |
| 485 | 484 | */ |
| 486 | 485 | $type_rules = apply_filters( 'content_control/rule_engine/post_type_rules', $type_rules, $name, $post_type ); |
| @@ -627,42 +626,8 @@ | ||
| 627 | 626 | ], |
| 628 | 627 | ], |
| 629 | 628 | 'callback' => '\ContentControl\Rules\content_is_selected_term', |
| 630 | 629 | ], $tax_defaults ); |
| 631 | - | |
| 632 | - if ( $taxonomy->hierarchical ) { | |
| 633 | - $rules[ "content_is_child_of_tax_{$tax_name}" ] = wp_parse_args( [ | |
| 634 | - 'name' => "content_is_child_of_tax_{$tax_name}", | |
| 635 | - /* translators: %s: Taxonomy plural name */ | |
| 636 | - 'label' => sprintf( __( 'A Child of Selected %s', 'content-control' ), $taxonomy->labels->name ), | |
| 637 | - 'fields' => [ | |
| 638 | - 'selected' => [ | |
| 639 | - /* translators: %s: Taxonomy plural name */ | |
| 640 | - 'placeholder' => sprintf( $strings['Select %s'], strtolower( $taxonomy->labels->name ) ), | |
| 641 | - 'type' => 'taxonomyselect', | |
| 642 | - 'taxonomy' => $tax_name, | |
| 643 | - 'multiple' => true, | |
| 644 | - ], | |
| 645 | - ], | |
| 646 | - 'callback' => '\ContentControl\Rules\content_is_child_of_term', | |
| 647 | - ], $tax_defaults ); | |
| 648 | - | |
| 649 | - $rules[ "content_is_ancestor_of_tax_{$tax_name}" ] = wp_parse_args( [ | |
| 650 | - 'name' => "content_is_ancestor_of_tax_{$tax_name}", | |
| 651 | - /* translators: %s: Taxonomy plural name */ | |
| 652 | - 'label' => sprintf( __( 'An Ancestor of Selected %s', 'content-control' ), $taxonomy->labels->name ), | |
| 653 | - 'fields' => [ | |
| 654 | - 'selected' => [ | |
| 655 | - /* translators: %s: Taxonomy plural name */ | |
| 656 | - 'placeholder' => sprintf( $strings['Select %s'], strtolower( $taxonomy->labels->name ) ), | |
| 657 | - 'type' => 'taxonomyselect', | |
| 658 | - 'taxonomy' => $tax_name, | |
| 659 | - 'multiple' => true, | |
| 660 | - ], | |
| 661 | - ], | |
| 662 | - 'callback' => '\ContentControl\Rules\content_is_ancestor_of_term', | |
| 663 | - ], $tax_defaults ); | |
| 664 | - } | |
| 665 | 630 | } |
| 666 | 631 | |
| 667 | 632 | return $rules; |
| 668 | 633 | } |