• Resolved davydov-denis

    (@davydov-denis)


    Dear All,

    I think I have a problem.
    There is functions.php file inside my theme. I can see it from
    admin page, it contains only remove_action functions:

    ...
    remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
    remove_action(...)
    ...

    The problem is that my WP pages still contain everything I try to remove. I added

    global $removeres = 'remove_action: ';

    at the beginning of functions.php, and try to echo variable in footer:

    <?php echo $removeres; ?>

    and I don’t see anything in footer.

    Thus I assume that the functions.php is not called at all.
    What I’m doing wrong?

    Kind regards,
    Denis.

Viewing 5 replies - 1 through 5 (of 5 total)
  • functions.php is always called.

    But I don’t understand how you don’t get a parse error…

    Declaration of the variable should be something like this:

    global $removeres;
    $removeres = 'remove_action: ';

    Try now that echo 🙂

    Thread Starter davydov-denis

    (@davydov-denis)

    Thanx for pointing to my PHP problems. I corrected the code and still see nothing in my footer. And footer is called since i tried to write some text like:
    before echo: <?php echo $removeres; ?>

    and I see only ‘before echo’. To me it still seems that functions.php are not called.

    Hmm… To see if it’s called or not, try adding a function in the functions.php

    function removeres(){
       echo "remove_action";
    }

    And then try calling it in the footer: removeres();

    See if that shows anything 🙂

    Thread Starter davydov-denis

    (@davydov-denis)

    <br>
    <b>Fatal error</b>
    : Call to undefined function removeres() in
    <b>...../footer.php</b>
    on line
    <b>2</b>
    <br>

    i told you, it’s not called! 🙂 what is wrong with it?

    p/s/ for any case I write my functions.php

    <?php
    
    global $removeres;
    $removeres = 'remove_action: ';
    if (!is_admin()) {
    	$removeres .= remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
        //remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
    	remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
    	remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
    	remove_action( 'wp_head', 'index_rel_link' ); // index link
    	remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
    	remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
    	remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post.
    	remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version
    }
    
    function removeres(){
       echo "remove_action";
    }   
    
    ?>

    Thread Starter davydov-denis

    (@davydov-denis)

    In case someone has similar problems, my function.php (the one i modified) was not called, probably, due to some cache issues, after a while (several hours) – everything worked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘functions.php of a theme is not called ?’ is closed to new replies.