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');

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

  • This will not solve the problem with links in the content. – Mark Kaplun Apr 13 '16 at 5:25

You could use some JavaScript to change all links on page load. It's maybe not the best solution, but it works. I've written a JSFiddle for demonstration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.