Issue with Pretty Permalinks and the “Post Page” setting
-
Hi Guys
Having an absolute nightmare and I can’t come across anything like it online.
I’m developing a theme for the website above using custom post types, custom meta data and all around custom page templates for all of the above.When it comes to me setting a simple page for the blog element of the site /blog/ and attributing the POSTS PAGE setting to it within the reading settings in the wordpress backend … nothing happens. Usually when you do that, the page in question gets a body class of blog and loads the standard query of if posts have posts etc. Whereas – this loads no posts and still has page-template-default as the main body class, which leads me to think there’s a biggggg error somewhere.
I’ve deactivated all plugins
I’ve reset my permalinks
I’ve even reset the htaccessHere’s the weird thing – when I change my permalinks to postID – the page works as expected… but as soon as I change back to “Pretty permalinks” it breaks.
Anyone got any ideas? I’ve also got this artefact in my functions.php
function gp_add_cpt_post_names_to_main_query( $query ) { if ( ! isset( $query->query['page'] ) || 2 !== count( $query->query ) ) { return; } if ( empty( $query->query['name'] ) ) { return; } $query->set( 'post_type', array( 'post', 'page', 'books', 'events' ) ); } add_action( 'pre_get_posts', 'gp_add_cpt_post_names_to_main_query' );
Which I worryingly can’t get rid of without 404’ing half my working pages. This makes me query them being linked but I’m too far down the rabbit hole to be able to properly troubleshoot.
Any ideas?
The page I need help with: [log in to see the link]
- The topic ‘Issue with Pretty Permalinks and the “Post Page” setting’ is closed to new replies.