• Hai, how do I apply the code below with a hook from @generatepress, because I don’t want to open the theme editor. the code to remove index pagination. Please help me. thank you.

    <?php if ( is_paged() ) : ?>
    <meta name=”robots” content=”noindex, follow”>
    <?php endif; ?>

Viewing 7 replies - 1 through 7 (of 7 total)
  • Leo

    (@leohsiang)

    Hi there,

    Which hook are you trying to add the code to?

    It doesn’t look like something that should be added in a hook.

    Thread Starter sworty

    (@sworty)

    one of the tutorials removes index pagination, that code must be saved between template heads, I’m using child theme and don’t find head.php in theme editor, I don’t want to open code from parent theme, how to save code in child theme?

    Hi there,
    this is a simple example that you can add into the file functions.php of he child theme:

    function no_index() {
     if ( is_paged() ){
    echo '<meta name=”robots” content=”noindex, follow”>';
    }
    add_action('wp_head', 'no_index');

    wp_head

    Thread Starter sworty

    (@sworty)

    Is it right?
    so I implement it in the function, no need in the head?
    but is it true that is the correct code to remove pagenation index /page/2 from SERP ?
    Understandably I’m still learning, do not understand the placement of the code.
    thank you very much

    Leo

    (@leohsiang)

    It should be.

    The function is added to the wp_head hook which is a WP core hook inside the <head>:
    https://github.com/tomusborne/generatepress/blob/master/header.php#L17

    Thread Starter sworty

    (@sworty)

    thanks for all the answers, I really appreciate you.

    so what I have to do is :

    Go to Elements > Select Hook.
    code on the screen.
    In the Settings = wp_head.
    In the Display Rules = ?
    location = All Singular.

    maybe like that ?
    I’m sorry to bother you, I really don’t understand.

    Leo

    (@leohsiang)

    Elements is a premium option so we are not allowed to support it here – it’s a WordPress rule.

    Can you open a support topic in our premium forum?
    https://generatepress.com/support/

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Page/2/ index’ is closed to new replies.