flexible rewrite ‘ramble’ URLs with WordPress

You shouldn’t use the htaccess instead you should use the WordPress APIs e.g. function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘archives/(\d+)(?:/.*)+’ => ‘index.php?p=’. $wp_rewrite->preg_index(1) ); // ( array merge must be done this way, to ensure new rule comes first ) $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if … Read more

Change the url of Projects in Divi Theme

For the taxonomies (like category or any other custom taxonomies, registered for the custom post type, using register_taxonomy function ), to be part of single post permalinks in wordpress, you may use the following code in your functions.php of the current theme: function my_post_type_link( $post_link, $post ){ if( !empty( $post->post_type ) && in_array( $post->post_type, array( … Read more

I am Looking to append URL Parameter to all URLs

I don’t know if you still need the answer, but here’s working example for you. Header.php /*SAVE $_GET[‘aff’] TO COOKIE*/ if(!isset($_SESSION[‘aff’]) and $_GET[‘aff’]){ $cookie_expire = time()+60*60*24*30; $_SESSION[‘aff’] = $_GET[‘aff’]; setcookie(‘aff’, $_SESSION[‘aff’], $cookie_expire, “https://wordpress.stackexchange.com/”, ‘.’.$_SERVER[‘HTTP_HOST’]); } Functions.php – if you need to pass one parameter /*APPEND ‘aff’ PARAMETER IN URL THROUGH WHOLE SITE*/ function wprdcv_param_redirect(){ if(isset($_COOKIE[‘aff’]) … Read more

custom htaccess rewrite rule for page

You can do this with WordPress’ built-in rewrite system. function add_video_rewrite() { add_rewrite_tag(“%video_id%”, ‘([^/]*)’); add_rewrite_tag(“%video_src%”, ‘([^/]*)’); add_rewrite_tag(“%video_title%”, ‘([^/]*)’); add_rewrite_rule(‘^video/([^/]*)/([^/]*)/[^/]*)’, ‘index.php?pagename=video&video_id=$matches[1]&video_src=$matches[2]&video_title=$matches[3]’, ‘top’); } add_action( ‘init’, ‘add_video_rewrite’ ); Didn’t test it, but I think this should work. What is does is first adding tags that you can use in your template (get_query_var(video_id)). Then add a rewriterule that … Read more

Mapping multiple URLs to same page

You can use the same answer as the question you referred to (I have answered it). Here’s how you would change to pass the arguments: <?php add_action(‘init’, ‘add_my_rule’); function add_my_rule() { global $wp; $wp->add_query_var(‘args’); add_rewrite_rule(‘test\/finaldestination\/(.*)’,’index.php?pagename=about&args=$matches[1]’,’top’); } ?> Assuming ‘finaldestination’ stays the same always, and the pagename (slug) is ‘about’ (you can change both). Apply your … Read more

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