• 0
Sign in to follow this  
Followers 0

Audio Player Audio Player custom post type conflict resulting in 404

Question

Posted · Report post

Hi Aleksander,

 

While troubleshooting a custom post type registration issue that was resulting in 404's, we discovered that audio-player flushes rewrite rules in the post_type_setup function which is called by section_persistent. Our custom post type registration calls flush_rewrite_rules() only on plugin activation after it is registered and it appears that the call by audio-player (on every page load?) resets it resulting in 404's on our new post type.

 

 

 Here is how our post type is registered and activated ($args not included for sake of brevity)

function create_wpappdev_cpt() {
  $args = //args are added here, labels, description, rewrite, etc;

  register_post_type( 'wpappdev_cpt', $args )

}
 
add_action( 'init', 'create_wpappdev_cpt' );

function activate_wpappdev_cpt() { // register custom post type create_wpappdev_cpt(); // flush rewrite rules flush_rewrite_rules( false ); }
register_activation_hook( __FILE__, 'activate_wpappdev_cpt' );
 

 

 

With this setup, if audio-player is activated, our custom post results in a 404. After audio-player is disabled, and after a visit to the permalinks page to flush rewrites, our custom post type works fine.

 

 

I see the audio-player custom post type is registered with the PageLinesPostType class, which I am not familiar with. Is it possible to flush_rewrite_rules on activation and deactivation only?
 
Thanks,
 
Justin

 

Share this post


Link to post
Share on other sites

1 answer to this question

  • 0

Posted · Report post

Hi Justin,

In the latest version I have removed the flush_rewrite_rules() as I discovered that it actually wasnt needed.

I am not able to push any updates through the store at the moment, but I have setup my own store at http://shop.ahansson.com which features auto updates.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0