Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 on single post page #62

Open
sijones-uk opened this issue Sep 13, 2016 · 8 comments
Open

404 on single post page #62

sijones-uk opened this issue Sep 13, 2016 · 8 comments

Comments

@sijones-uk
Copy link

Since version 2.1.0 I'm getting 404s on all of my single post pages for custom post types. My custom post type (wpbb_job) is defined inside another plugin (WP Broadbean) and has a rewrite slug of 'jobs'. Before v2.1.0 I was able to define the permalink as:

http://<domain>/jobs/%wpbb_job_industry%/%postname%/

where wpbb_job_industry is the taxonomy. This would be transformed into something like this:

http://<domain>/jobs/marketing/digital-marketing/project-manager/

Since v2.1.0 the permalinks are being converted correctly, but clicking on them results in a 404. Previously the correct post would be displayed.

I've narrowed the problem down to Rewrite.php, in particular where you tidied up the code in the add_hook() function and removed the add_action( 'wp_loaded', array( $this, 'add_rewrite_rules' ), 10 ); after v2.0.2. I can't work out why this is causing the 404 though.

@danielshields
Copy link

@sijones-uk have you found any workarounds for this? I tried, but was unsuccessful. For now, are you just using an earlier release?

@sijones-uk
Copy link
Author

@danielshields Unfortunately not, so I can't update the plugin for now, It seems to have been the removal of the line add_action( 'wp_loaded', array( $this, 'add_rewrite_rules' ), 10 ); in Rewrite.php when v2.1.0 was released that broke things. If you want to ensure that the plugin doesn't get accidentally updated you can temporarily change the "Version" in custom-post-type-permalinks.php to 999. However, that's not a good long-term strategy. I haven't found an alternative plugin that does what I need either.

@Trenbania
Copy link

I've exactly the same issue - thanks @sijones-uk for the tip to fix in the meantime!

@torounit
Copy link
Owner

@sijones-uk @danielshields @Trenbania
Sorry for late reply.

Replace CPTP_Module_Rewrite use CPTP_set_rewrite_module filter.

Sample code https://gist.github.com/torounit/86c3c140071d29cd1b2fd2900f23c813.

@sijones-uk
Copy link
Author

Thanks @torounit. Will this fix be folded into the master branch?

@wildfang
Copy link

wildfang commented Feb 6, 2017

This seems to be still open with 3.0.0?
How can I fix it? My CPT Single is suddenly a 404...

@caiobleggi
Copy link

Version 3.1.1 still with this problem. :'(
I'm deactivating the plugin until this is fixed on master, so sad.

@enkodellc
Copy link

Review my comment on #79 for my solution with a 404 handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants