WordPress add_query_arg from ajax and make url friendly

This add_query_arg function is add argument after URL you have enter. You have to get pretty URL so add below code in your functions.php file : function custom_rewrite_rule() { add_rewrite_rule(‘^cars/([^/]*)/([^/]*)/?’,’index.php?page_id=PAGE_ID&type=$matches[1]&models=$matches[2]’,’top’); flush_rewrite_rules(); } add_action(‘init’, ‘custom_rewrite_rule’, 10, 0); function custom_rewrite_tag() { add_rewrite_tag(‘%type%’, ‘([^&]+)’); add_rewrite_tag(‘%models%’, ‘([^&]+)’); } add_action(‘init’, ‘custom_rewrite_tag’, 10, 0); add_action( ‘wp_ajax_get_prepare_link’, ‘prepare_link’); add_action( ‘wp_ajax_nopriv_get_prepare_link’, ‘prepare_link’); function … Read more

How to create multiple Rewrite-Rule for various site in single htaccess?

I’m currently using this- # TN – BEGIN https to https <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^scorewheel\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.scorewheel\.com$ RewriteRule .* https://scorewheel.com%{REQUEST_URI} [R=301,L] </IfModule> # TN – END http to https # TN – Begin cdn redirection <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^cdn.scorewheel\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.cdn.scorewheel\.com$ RewriteCond … Read more

Multiple Custom Taxonomy Rewrite

You must use separate base for both custom taxonomies. For example: default URL: /chalets/ location term URL: /chalets/location/%location% type term URL: /chalets/type/%type% Rewrite rules need to identify the requested custom taxonomy via URL. So, a base URL identifier is required in your case.

How to get relative page for every post: /post-1/contact. /post-2/contact

Yes, it’s possible, but think about what WebElaine wrote in comment. You’ll need a query variable (e.g. jobname) to store the name of jobs custom post type. You also need a rewrite rule that interprets /jobs/{post-slug}/contact address as a “contact” page and keep {post-slug} in query variable jobname. add_filter( ‘query_vars’, ‘se354723_query_vars’ ); add_action( ‘init’, ‘se354723_rewrite_job_contact’ … Read more