Load a specific post if user tries to access 404 page

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

Creating FPDF directly in the browser using template_rediect

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

What hooks, actions or filters i can use to customize wordpress registration page and form?

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