Add a query string to ALL links on site

Our client would like to embed his site into an iframe in their software backend. I get a query string on the first link but need to make sure that string persists across URLs for all links and navigation on the iframed site. How do I do that?

This only needs to happen when the query string is present.

EDIT: Come this far, just don’t know what to do to persist the clean=true query where it appears.

function add_rewrite_rules($aRules) {
    $aNewRules = array('^/([^/]+)/?$' => 'index.php?clean=$matches[1]');
    $aRules = $aNewRules + $aRules;
    return $aRules;
}

add_filter('rewrite_rules_array', 'add_rewrite_rules');
function add_query_vars($qvars) {
    $qvars[] = "clean";    
    return $qvars;
}
add_filter('query_vars', 'add_query_vars');

2 Answers
2

As I understand your Question, you need to hook into most of the Link Filters (which are listed here: http://codex.wordpress.org/Plugin_API/Filter_Reference#Link_Filters ) and then add the query to them if the queryvar “clean” is set.

Happy Coding,
Kuchenundkakao

Leave a Comment