Hot answers tagged

1

The problem must be how you define your post variable. You assume it's the global $post but that's not always the case especially in non-singular pages like archives. The filter itself provides the correct post instance that's it's been called on as 2nd parameter. function product_type_permalink( $post_link, $post ) { // current post is already ...


1

Got it to work, changing the regex from (.+) to (.*) Maybe helpful for others searching same rewrite on search and pagination. add_rewrite_rule('discover/interiors/interior-results/(.*)/page/([0-9]{1,})/?', 'index.php?pagename=discover/interiors/interior-results&tag1=$matches[1]&paged=$matches[2]', 'top' ); ...


1

I fixed my problem as follows: // Adds rewrite rules for shop post type function gtp_add_shop_rewrite_rules() { add_rewrite_rule( '^shop/([^/]*)/([^/]*)/([^/]*)$', 'index.php?shop-category=$matches[1]&width=$matches[2]&height=$matches[3]', 'top' ); add_rewrite_rule( '^shop/([^/]*)/([^/]*)$', ...



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