URL rewrite before template_redirect called

So the problem was redirect_guess_404_permalink was detecting a 404 error and ‘guessed’ /members/blog to be /blog My hacky solution was to hook into the status error check (Stop WordPress from “guessing” redirects for nonexistent URLs) and if URL parts match then unset the guessed solution function blog_no_redirect_guess_404_permalink( $header ){ global $wp_query; if( is_404() ) { …

Read more

Clone a Post Tite and Custom Field into Custom Post type

Something like this should work- if( get_post_meta( $post_id, ‘_surl_post_id’, true ) ) { // we have an old post created here update_post_meta( get_post_meta( $post_id, ‘_surl_post_id’, true ), ‘_surl_redirect’, get_post_meta( $post_id, ‘url’, true ) ); return; } // Prepare contents $add_cpt_clone = array( ‘post_title’ => $post_object->post_title, ‘post_status’ => ‘publish’, ‘post_type’ => ‘surl’ ); // Insert the …

Read more