Friday 29 July 2022

Overrite wordpress template file using hooks.

    function my_plugin_custom( $template ) {

if( is_404() ){

        $template =  get_template_directory(). '/templates/404.php';

    }

return $template;

}

add_filter( 'template_include', 'my_plugin_custom' ); 

No comments:

Post a Comment