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

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