• Resolved satrntgr

    (@satrntgr)


    Ever since the updates, I’ve received this error at the bottom of every post:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, class ‘TC_post_metas’ does not have a method ‘tc_post_metas’ in /home/content/91/11903191/html/wp-includes/plugin.php on line 496

    I had the problem before and disabled plugins, checked html and nothing would fix it. Went into goDaddy to check this line out and nothing looks wrong. Does anyone know what I can do to remove this error message? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,
    do you have a child theme?
    Do you have any copy of the parent files in your child-theme?
    Do you have any function in your child-theme functions.php which refers to that method ‘tc_post_metas’?

    Theme Author presscustomizr

    (@nikeo)

    Thanks for reporting this. As Rocco suggested it, can you please share more infos about your system infos (theme version, child theme if any, plugins ) ? This bug doesn’t look good at all and I can’t reproduce it.

    Thanks!

    Thread Starter satrntgr

    (@satrntgr)

    This is the data in my child theme – what should I edit:

    <?php //Opening PHP tag

    // Custom Function to Include
    function favicon_link() {
    echo ‘<link rel=”shortcut icon” type=”image/x-icon” href=”/favicon.ico” />’ . “\n”;
    }
    add_action( ‘wp_head’, ‘favicon_link’ );
    //we hook the code on the __before_body hook, which is executed before the <body> rendering.
    add_action (‘__before_body’ , ‘move_single_post_metas’);

    function move_single_post_metas() {
    //checks if we are displaying a single post. Returns false if not.
    if ( !is_single() )
    return;
    //we remove the original action hooked on ‘__post_metas’. tc_post_metas action is a method of the TC_post_metas class
    //We can access the instance of this class with a static property of this class that is a self instance.
    remove_action ( ‘__after_content_title’ , array( TC_post_metas::$instance , ‘tc_post_metas’ ));

    //we add the tc_post_metas action on a the __after_loop (check index.php file to see where this hook is called in the code)
    add_action (‘__after_loop’ , array( TC_post_metas::$instance , ‘tc_post_metas’), 10);

    //Additional action to display an hr separator between content and metas.
    //We use the priority parameter to determine the rendering order of the action
    add_action (‘__after_loop’ , ‘display_hr’, 0);

    //this is a nested function (function in another function), allowed with PHP.
    function display_hr() {
    ?>
    <hr/>
    <?php
    }
    }
    //Closing PHP tag

    Hi satrntgr, so
    in the code above replace this:
    remove_action ( '__after_content_title' , array(TC_post_metas::$instance , 'tc_post_metas' ));

    with this
    remove_action ( '__after_content_title' , array( TC_post_metas::$instance , 'tc_set_post_metas_hooks' ), 20);

    and this:
    add_action ('__after_loop' , array( TC_post_metas::$instance , 'tc_post_metas'), 10);

    with this:

    add_action ('__after_article' , array( TC_post_metas::$instance , 'tc_set_post_metas_hooks'), 10);

    And everything should be fine.
    ??

    p.s.
    snippet updated -> https://themesandco.com/snippet/moving-single-post-metas-to-the-bottom-of-the-post/

    Thread Starter satrntgr

    (@satrntgr)

    That worked, thanks!! What was the difference in those?

    Hi, glad to hear that.
    Nothing special, it’s just that recently those methods names are changed. In fact you didn’t get an ERROR, just a WARNING + that code didn’t work ??
    I mean, of course you had to solve it, but luckily this kind of problems don’t give you the White Screen Of Death, or something of the sort ??
    The only other thing that is changed is the priority of this action hook:
    _action ( '__after_content_title' , array( TC_post_metas::$instance , 'tc_set_post_metas_hooks' ), 20);
    before you shouldn’t specify it ’cause it was the default one, now is 20.

    Hope I’ve been understandable. ??

    Can I ask you to set this topic as resolved, so if other users have the same issue maybe they can rapidly see it’s something solvable ??

    Cheers

    Thread Starter satrntgr

    (@satrntgr)

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘TC_Post_Metas Error…AGAIN!!!’ is closed to new replies.