'template_include' hook still has 404 status
-
I’m writing a plugin that uses the ‘template_include’ hook to include a specific template file. The plugin is for internal use.
add_filter( 'template_include', function( $template ) { global $wp_query; if( 'page-name' == $wp_query->query_vars['pagename'] ) { header("Status: 200"); add_filter( 'wp_title', function() { return 'Thank you! ‹ '; } ); return plugin_dir_path( __FILE__ ) . 'templates/some-template.php'; } return $template; } );The problem is WordPress is returning this page with the http header status of 404. Even when I try to mark the status as 200 okay, it still doesn’t work. How can I fix this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘'template_include' hook still has 404 status’ is closed to new replies.