Tag Info

Hot answers tagged

3

Are you calling flush_rewrite_rules at any moment? If you are going to change the slug of a custom post type, you also have to call the flush_rewrite_rules. You can find more documentation here Setting up custom post type archives in WP3.1? Any luck? And here https://codex.wordpress.org/Function_Reference/flush_rewrite_rules


2

The rewrite rule already exists to handle those requests, it's for pagination of a single page post type. You can get the value of the page number with get_query_var('page'). You can render all pages with the same template by creating a page-{page-name}.php template file.


2

It sounds like you need get_author_posts_url() which "Gets the URL of the author page for the author with a given ID." If you have set the custom permalink correctly it should work. If you really are looking for actual page IDs, there is no page ID for an author archive page. Those pages are dynamically generated and are not "posts", "pages", or any other ...


1

Use pagename instead of page_id to query by slug. Note that if a page is a child of another page, pagename has to be the full parent/child path to the page, since slugs only have to be unique per-level in hierarchical post types. See WP_Query for the full list of query vars.


1

I searched everywhere in post type registration flow but didn't found a right way (using filter or action) to do it. All you can do either register the post type again with a different slug (I prefer) or just run those lines of code which WordPress run to build the rewrite rules in register_post_type. I register this post type with slug book and changed it ...


1

I ended going the CPT route, as I couldn't figure out other way. Just added a bunch of logic to duplicate/modify/delete the normal posts when needed. <?php // function for the CPT function SU_kuuma_kysymys_type() { // creating (registering) the custom type register_post_type( 'kuuma_kysymys', /* ...


1

After some brainstorming and a lot of trial and error with T5 Rewrite and HM Rewrite, I went for the simplest possible solution. The permalink was actually intercepted by WordPress so I didn't need the additional rewrite rule (even though it didn't hurt, other than performance). I left %category%/%post_id%/%postname% as the default custom permalink, and it ...



Only top voted, non community-wiki answers of a minimum length are eligible