How to redirect all page requests to a single “goodbye” homepage? [duplicate]

I found the answer with a little more searching. Sorry — Admins feel free to delete this question! The answer is here add_action( ‘template_redirect’, ‘wpse_76802_maintance_mode’ ); function wpse_76802_maintance_mode() { if ( ! is_page( 1618 ) ) { wp_redirect( home_url( ‘index.php?page_id=1618’ ) ); } } EXCEPT …. if there is a way to enhance this redirect … Read more

How to redirect logged out users to specific page?

home_url() will accept a parameter that will be used in the creation of the URL. The bare minimum solution would be: add_action( ‘wp_logout’, create_function( ”, ‘wp_redirect(home_url(“/path/to/page”));exit();’ ) ); site_url() will also accept the same parameter and may be (probably is) a better choice. I believe that using either of those will make the link dependent … Read more

Trying to map a PURL like url to a page

If BigOffer part is static it can be easyly done with a rewrite rule: add_action(‘init’, ‘big_offer_rule’); function big_offer_rule() { add_rewrite_rule(‘^BigOffer([0-9]+)/?’,’index.php?pagename=bigoffer&offerId=$matches[1]’,’top’); } add_filter(‘query_vars’, ‘big_offer_vars’); function big_offer_vars( $vars ) { return array_merge($vars, array(‘offerId’) ); } After you added this code, you have to flush rules going in Settings -> Permalinks section in your backend and saving changes. … Read more

Select post from dropdown and add query args not working

Rename your <select> to something other than page_id. The problem is that page_id is already taken (and handled) by WordPress (as query var). This should do, for example: <?php if (isset($_GET[‘editevent’]) && true == $_GET[‘editevent’]) echo ‘Post ID: ‘.$_GET[‘my_page_id’]; ?> <form method=”GET” action=”#”> <select name=”my_page_id” id=”my_page_id” onchange=”this.form.submit()”> <?php $args = array( ‘posts_per_page’ => -1, ‘post_type’ … Read more

Interested in redirection techniques for one-page themes

Two (give or take) points to consider here. One – we don’t want anyone to see direct links in first place. Scrubbing them from admin side is quite a pain, but a post_link filter in get_permalink() (and maybe couple more filters in others) should allow to (mostly) override those. Two – we don’t want users … Read more

Preventing Canonical Redirect for CDN

This can not work in the way you want. If wordpress is on example.com then all the auto generated links will point to example.com even for pages that are on the CDN under the www.example.com domain. This will result that after the first page being served from the CDN many other pages will be served … Read more