Rewrite Rule for Post Meta

Okay! So I got this working by just changing the rewrite_rule to include the event… function aca_award_cat_rewrite_rule() { add_rewrite_rule( ‘^awards/([^/]*)/award-category/([^/]*)/?’, ‘index.php?competition=$matches[1]&award_category=$matches[2]’, ‘top’ ); }

Set parent for custom post type archive rewrite url

First, you need to register the %office% rewrite tag: // First, add the rewrite tag. add_rewrite_tag( ‘%office%’, ‘([^/]+)’, ‘post_type=office_members&office_name=” ); // Then call add_permastruct(). add_permastruct( “office_members’, … ); Then, add the custom office_name arg to the public query vars so that WordPress reads/parses it from the URL: add_filter( ‘query_vars’, function ( $vars ) { $vars[] … Read more

How to override url params with rewrite rules vars?

“hi” message is displayed instead of “hello” in the second example Yes, because that’s how it works: query_vars is a hook for registering custom query vars that are public, so if the URL query string contains the custom query var, then WordPress will set the query var to the value parsed from the query string. … Read more

Bilingual WP site: How to achieve different URL sturcture rule based on its language?

Try the following steps: Add the rewrite rules for the <language>/blog/%category%/%post_id% structure. I used the post_rewrite_rules hook to add the rewrite rules, but for generating the rewrite rules, I used WP_Rewrite::generate_rewrite_rules() the same way WordPress core used it to generate the rewrite rules for the default permalink structure (that you set via the Permalink Settings … Read more

Combine multiple CPT names to create valid permalinks

Sally CJ commented an important detail that helped me reach what I needed. Apart from that I struggled with what seemed to be regex error – one of my rules was overriding another because there was no $ character in regex to end the string. Working solution for custom rewrites: function dd_custom_rewrite_rules() { add_rewrite_tag(‘%company%’, ‘([a-z0-9-]+)’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)