Support » Fixing WordPress » single_template filter is missing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz


    It is indeed gone. All of the filters in the various get_???_template() functions have been removed. Not sure a workaround exists.


    Why have they got rid of them. It doesn’t make any sense.

    I hope someone can help with a workaround.

    Is it? I notice that there is still filter {$type}_template in wp-includes/template.php (Line: 28)



    Hi All, same problem.

    Now I am using below code for load the template for my custom post type from my plugin folder.

    function (My_Custom_Post_Type)_template($single_template) {
         global $post;
         if ($post->post_type == '{My_Custom_Post_Type}') {
              $single_template = dirname( __FILE__ ) . '/templates/{My_Custom_Post_Type}-template.php';
         return $single_template;
    add_filter( "single_template", "{My_Custom_Post_Type}_template" );

    How could I replace the above “single_template” filter.

    How could I have use this {$type}_template?

    Please help!

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]



    Forum Moderator

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘single_template filter is missing.’ is closed to new replies.