Question about proper use of wp_redirect?

It seems this would just be a function of your theme. If you don’t provide links to single posts, categories, etc., then as far as your visitors are concerned, those things effectively don’t exist. If you really want to prevent access to things, you can’t redirect in a template as headers have already been sent. … Read more

How we redirect to other pages in WordPress?

You could do the redirect by means of JavaScript: <a href=”#” class=”fright hrtacnhor” onclick=”window.location='<?php echo get_permalink( 8 ) ?>'”>save to my favorite</a> But why yould you want to do it that way and not just use the link directly?

how to use wp_redirect inside a function

You do not get that error because it runs inside a function, but because the headers have already been send. This means your server already has send some information about the page to the client, thus is it unable to change it’s headers (headers are the first thing that gets send). This mostly happens after … Read more

Force Rewrite Query Var On Hierarchical (Nested) Page

Just in case any one needs this: /* Register Query Var —– */ function my_queryvar_params( $query_v ) { $query_v[] = “my_var”; return $query_v; }; add_filter(‘query_vars’, ‘my_queryvar_params’); /* Rewrites —– */ function setup_filter_rewrites(){ add_rewrite_rule(‘^my-parent/my-page\/([0-9]+)\/?’, ‘index.php?pagename=my-parent/my-page&my_var=$matches[1]’, ‘top’); // As @Milo mentioned, the pagename paramenter needs to reflect the path hierarchy }; add_action( ‘init’, ‘setup_filter_rewrites’ ); /* Force … Read more

wp_redirect and get variables

Well.. I got it working. Even though the URL loses the GET variable, its still set and working. A simple if(isset($_GET[“saved”])) returns true and I can keep doing what i intended. The fact that the variable appears and disappears in seconds from the URL confused me. ¯|_(ツ)_|¯

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