Tag Info

New answers tagged

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 ...


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.


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

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.


0

You can try selecting the $post_id where $page_name = $page_name


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


0

Set permalink to (Post Name) or http://www.example.com/[blog_name]`/%post_id%/%postname%/` Add following code to functions.php of your theme: add_filter ( 'alias_rule', 'xili_language_trans_slug_qv' ) ; function xl_permalinks_init () { global $XL_Permalinks_rules; if (class_exists('XL_Permalinks_rules') ) { $XL_Permalinks_rules = new ...


0

There isn't much "dynamic" about actually creating folder tree and index files in it. What you have right now is completely tangential to your WordPress installation. In a nutshell, if you need to integrate this with WordPress, you have two approaches: Load WordPress core in your code. This can be done with including wp-load.php and some fine–tuning, but ...


0

If you change the structure of the permalink, you have to provide the rewrite rules to understand the new structure. Also, you are not building the attachment permalink correctly. The next code is working: add_filter( 'attachment_link', 'wpd_attachment_link', 20, 2 ); function wpd_attachment_link( $link, $attachment_id ){ $attachment = get_post( ...


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 ...


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', /* ...



Top 50 recent answers are included