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

WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)

Step 2. However, when I submit an un-matching password, the form is redisplayed and URL is now http://example.com/wp-login.php?action=resetpass&key=xyz&login=zyx. Notice, that action has changed. When I attempt this with an invalid key I get redirected to http://example.com/wp-login.php?action=lostpassword&error=invalidkey. Anyway, the infinite loop is occurring because you are the condition in_array( $action, array(‘rp’, ‘resetpass’) ) remains true for … Read more

Weird: /?name in URL leads to blog

Those are reserved keywords When you visit a WordPress blog you have: blogindexpage/?queryvariables=queryvalues So for a search request: example.com/?s=searchterm For a post/page of ID 12: example.com/?p=12 etc etc Pretty permalinks hides all this by using regular expressions to map nice looking URLs on to their equivalents. This doesn’t prevent someone from still doing that though, … Read more

Having Problem On Getting WP Post Gallery Images URL

As I’ve explained elsewhere, you can modify the image sizes of the get_post_gallery() or get_post_gallery_images() with a simple filter: // Add a filter for full gallery size: add_filter( ‘shortcode_atts_gallery’,’wpse_full_size_gallery’ ); $gallery = get_post_gallery( get_the_ID(), false ); // Remove the filter: remove_filter( ‘shortcode_atts_gallery’,’wpse_full_size_gallery’ ); where: function wpse_full_size_gallery( $out ) { $out[‘size’] = ‘full’; // Edit this … Read more