diff --git a/classes/PodsInit.php b/classes/PodsInit.php index 9eceece695..cc05532457 100644 --- a/classes/PodsInit.php +++ b/classes/PodsInit.php @@ -882,9 +882,6 @@ public function setup_content_types( $force = false ) { $ct_post_types = $options['post_types']; $options = $options['options']; - $options = apply_filters( 'pods_register_taxonomy_' . $taxonomy, $options, $taxonomy ); - $options = apply_filters( 'pods_register_taxonomy', $options, $taxonomy ); - $options = self::object_label_fix( $options, 'taxonomy' ); /** @@ -908,6 +905,24 @@ public function setup_content_types( $force = false ) { pods_debug( array( $taxonomy, $ct_post_types, $options ) ); } + /** + * Allow filtering of taxonomy options per taxonomy. + * + * @param array $options Taxonomy options + * @param string $taxonomy Taxonomy name + * @param array $ct_post_types Associated Post Types + */ + $options = apply_filters( 'pods_register_taxonomy_' . $taxonomy, $options, $taxonomy, $ct_post_types ); + + /** + * Allow filtering of taxonomy options. + * + * @param array $options Taxonomy options + * @param string $taxonomy Taxonomy name + * @param array $ct_post_types Associated post types + */ + $options = apply_filters( 'pods_register_taxonomy', $options, $taxonomy, $ct_post_types ); + register_taxonomy( $taxonomy, $ct_post_types, $options ); if ( ! empty( $options['show_in_rest'] ) ) { @@ -926,9 +941,6 @@ public function setup_content_types( $force = false ) { continue; } - $options = apply_filters( 'pods_register_post_type_' . $post_type, $options, $post_type ); - $options = apply_filters( 'pods_register_post_type', $options, $post_type ); - $options = self::object_label_fix( $options, 'post_type' ); // Max length for post types are 20 characters @@ -943,6 +955,22 @@ public function setup_content_types( $force = false ) { pods_debug( array( $post_type, $options ) ); } + /** + * Allow filtering of post type options per post type. + * + * @param array $options Post type options + * @param string $post_type Post type name + */ + $options = apply_filters( 'pods_register_post_type_' . $post_type, $options, $post_type ); + + /** + * Allow filtering of post type options. + * + * @param array $options Post type options + * @param string $post_type Post type name + */ + $options = apply_filters( 'pods_register_post_type', $options, $post_type ); + register_post_type( $post_type, $options ); // Register post format taxonomy for this post type