• Resolved maximmmus

    (@maximmmus)


    Hi,
    I want to remove the pagination on my front page, which is a static homepage.
    I see this in the source:
    <link rel='next' href='http://domain/page/2/'/>

    I use this code below but for some reason it doesn’t work:

    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 2 );

    Why is this code not removing the pagination?

    • This topic was modified 6 years, 11 months ago by maximmmus.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Try 10,0 instead of 10,2 as that function takes no parameters.

    Thread Starter maximmmus

    (@maximmmus)

    I just tried this but the /page/2/ is still there in the source. Anything else I could try?
    Thanks

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Check header.php of your theme to see if the code is explicitly used there.

    Thread Starter maximmmus

    (@maximmmus)

    When I delete this <?php wp_head(); ?> from the header, the /page/2/ goes away.
    The wp_head comes from wordpress, I do not understand why is not possible to remove the action.

    I successfully removed the wlwmanifest_link, feed_links and rsd_link, but the posts_rel_link doesn’t want to deactivate. I don’t know what to do….

    Moderator bcworkz

    (@bcworkz)

    Removing wp_head() will likely break many things, though it does confirm something hooked to it is responsible. I think you already knew that. To remove an action callback, you must supply arguments that exactly match those used when it was added. Your removal code must also occur after the callback was added. Obvious when stated, but can be far less obvious in practice because when code executes is not always apparent.

    If the callback was added in plugin or theme code that executes on load, removing it from within a callback hooked to “init” will work. If it was added within another callback, hook the same thing, but with a later priority. Remove from within this callback.

    Thread Starter maximmmus

    (@maximmmus)

    Hi @bcworkz,

    Thanks for your detailed support. It has helped me trace down the issue.

    My theme had this remove_action callback built in the functions file, which it has been working previously. I went through your steps and found out this to be a plugin issue.

    Thanks for help

    Moderator bcworkz

    (@bcworkz)

    Ah, good call checking for plugin conflicts! I’m glad you were able to find it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘remove action adjacent_posts_rel_link_wp_head’ is closed to new replies.