Jump to content


Photo
Audio Player

Audio Player custom post type conflict resulting in 404



Best Answer ahansson89 , 19 August 2013 - 03:40 PM

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.

Go to the full post


  • Please log in to reply
1 reply to this topic

#1 wpappdev

wpappdev

    Newbie

  • Members
  • Pip
  • 1 posts
  • Country: Country Flag

Posted 18 August 2013 - 07:41 PM

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

 



#2 ahansson89

ahansson89

    Advocate

  • Members

  • 522 posts
  • Framework Version:DMS
  • Country: Country Flag

Posted 19 August 2013 - 03:40 PM   Best Answer

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.







Also tagged with one or more of these keywords: Audio Player