Display CPT taxonomies as an archive page

You’re describing the default behaviour. Based on your code, you will have the following URLs: https://www.url.com/blog/addresses/ The archive of all Articles. https://www.url.com/blog/city/tunis/ The archive of all Articles assigned to the Tunis City. https://www.url.com/blog/addresses/article-title/ The single Article. If any of these URLs are returning a 404, you likely just need to flush your permalinks. This needs … Read more

Extra url paths as variable

The correct way to register the rewrite rule and rewrite tag for your case is: function custom_rewrite_rules() { add_rewrite_tag(‘%nights%’, ‘([^&]+)’); add_rewrite_tag(‘%people%’, ‘([^&]+)’); add_rewrite_rule(‘house/(.+)/(.+)/(.+)/?$’, ‘index.php?house=$matches[1]&nights=$matches[2]&people=$matches[3]’, ‘top’); } add_action(‘init’, ‘custom_rewrite_tag’, 10, 0); The code has been tested and works correctly.

How To Use htaccess to Rewrite Link Structure for a Page that is Generated Programatcially

You’re looking to remove a post-type slug completely from the url. This is documented in this answer. Remember that after making any changes to post urls, you should resave your permalink structure for the changes to fully take effect. Edit: You can additionally redirect from the old location (with the slug), this way: function na_redirect_slug_requests() … Read more

How can I re-query post_type and rewrite the url?

I think you need to first define property_com_listing_type as a query: https://codepen.io/the_ruther4d/post/custom-query-string-vars-in-wordpress Then you can rewrite the urls with add_rewrite_rule (do not forget to save permalinks after change): https://codex.wordpress.org/Rewrite_API/add_rewrite_rule with a regex like ^category/([^/]+)/([^/]+)/? Then you can modify the query using pre_get_posts: https://developer.wordpress.org/reference/hooks/pre_get_posts/

Rewrite rule for custom permalink structure

Based on your comments in the question, I believe I have an answer. Visit your WP Admin Dashboard (example.com/wp-admin/) and click on Settings, then Permalinks. Here you will want to choose “Custom Structure” and use the following structure (copy/paste): /articles/%postname%-%post_id%.html This will enable the slug “articles” and the structure you are looking for, which is … Read more

WordPress URL redirect and replace ? question mark

Into wordpress function file add following code and check it. add_filter(‘query_vars’, function( $vars ){ $vars[] = ‘parent’; return $vars; }); function archive_rewrite_rules() { add_rewrite_rule( ‘^(.*)/(.*)/?$’, ‘index.php?post_type=client&name=$matches[1]&parent=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘^(.*)/?$’, ‘index.php?post_type=client&name=$matches[1]’, ‘top’ ); //flush_rewrite_rules(); // use only once } add_action( ‘init’, ‘archive_rewrite_rules’ );