Redirect wp-sitemap.xml not working
Redirect wp-sitemap.xml not working
Redirect wp-sitemap.xml not working
Cannot find redirect – WordPress behind HTTPS proxy (Cloudfront)
This is the final code that works. I had to set $wp_query->is_single = true; manually: add_action( ‘template_redirect’, function(){ global $wp_query; if ( is_404() ){ $id = 1; // the post corresponding to hello-world if ( $id ) { $wp_query->is_404 = false; status_header(200); header(“HTTP/1.1 200 OK”); $wp_query->query(“page_id=$id&post_type=post”); $wp_query->the_post(); $wp_query->is_single = true; } } }, 999);
Based on what you provided, I agree with the comment from @vancoder that caching is likely at play here. If you’re not sure how to purge the caching on your site, the easiest approach may be to add a simple query string on the end of the original URL. That usually bypasses caching and loads … Read more
Redirect drafted post of custom post type to URL?
Use ob_start();, ob_clean(); before outputting the PDF to make any uwanted content is not written while cretaing PDF. add_action(“template_redirect”, “checkRedirect”); function checkRedirect() { $url = (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’ ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”; $slug = strtolower(basename($url)); if ($slug == “pdf”) { ob_start(); require_once(getPath() . “fpdf.php”); $pdf = new \FPDF; $pdf->AddPage(); $pdf->SetFont(‘Arial’,’B’,16); $pdf->Cell(40,10,’Hello … Read more
You need to modify the login form on your custom login page. When using wp_login_form() you can include a redirect URL in the arguments (Codex Entry). The default URL is: ( is_ssl() ? ‘https://’ : ‘http://’ ) . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’] But you can override that: if (get_query_var(‘redirect_to’)) { $redirectURL = get_query_var(‘redirect_to’); wp_login_form(array(‘redirect’ => $redirectURL)); … Read more
It sounds like every time any page is loaded, if it meets the condition, it will try to redirect. So, if you’re viewing from Japan, and you hit the top-level site, you’ll be redirected. But then when you are redirected, the header.php code once again will see that you’re viewing from Japan, and try to … Read more
WordPress handles registration with wp-signup.php (in the root of the installation). There are some hooks in place to allow for additional content (such as a signup header, or additional signup fields), but it doesn’t support theming in the same way that other WP pages do. BuddyPress is a pretty heavy-duty solution if all you want … Read more
You’ll have to exit afterwards. add_filter( ‘template_redirect’, ‘wpse85164_query_var_template’ ); function wpse85164_query_var_template( $template ) { if ( ‘basic’ === get_query_var( ‘template’ ) ) exit( dirname( __FILE__ ).’/basic.php’ ); return $template; }