Conversation
supportI’ve been trying to hook into epr_post_types in my functions.php to work with a custom post type called “reports.” Is there example working code that a less-experienced coder can use to get it working? Thanks. https://wordpress.org/plugins/external-permalinks-redux/
FWIW – future strugglers, it’s butt-simple to edit line 93 of the plug-in to something like this: $post_types = apply_filters( ‘epr_post_types’, array( ‘post’, ‘page’, ‘report’ ) ); It works, just replace ‘report’ above with your CPT name. It would be nice to do this the proper way, but for now, it’s working.
Or, to make it work with all post types, change line 93 to: $post_types = array_values( get_post_types( array( ‘public’ => true, ‘_builtin’ => false ), ‘names’ ) ); Although I’m not sure that wouldn’t bloat the bejeezus out of your database.
This seems to work for me add_filter( 'epr_post_types', 'my_function' ); function my_function( $content_types ){ $content_types = array('my_content_type'); return $content_types; }
That works, thank you!
FWIW – future strugglers, it’s butt-simple to edit line 93 of the plug-in to something like this: $post_types = apply_filters( ‘epr_post_types’, array( ‘post’, ‘page’, ‘report’ ) ); It works, just replace ‘report’ above with your CPT name. It would be nice to do this the proper way, but for now, it’s working.
Or, to make it work with all post types, change line 93 to: $post_types = array_values( get_post_types( array( ‘public’ => true, ‘_builtin’ => false ), ‘names’ ) ); Although I’m not sure that wouldn’t bloat the bejeezus out of your database.
This seems to work for me add_filter( 'epr_post_types', 'my_function' ); function my_function( $content_types ){ $content_types = array('my_content_type'); return $content_types; }
That works, thank you!