Support » Plugins » Hacks » Remove rel from next_post_link

  • Resolved NIkesh Kr Yadav


    hi i am using
    <?php next_post_link( '%link class="prev" ', '<span></span> Previous Article', FALSE, '27 and 18 and 19 and 20 and 21 and 14' ); ?>
    and its output is <a href="" rel="prev"><span></span> Next Article</a>

    in this i want to remove rel="prev" and wants to add class=”prev”

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


    You could hook the filter ‘next_post_link’. Your hook function is passed the output string from your next_post_link() function call. You can use basic string operations to alter it as needed. Whatever you return is directly echoed out to the user’s browser.

    Thanks for help i have solved it as

    function add_class_next_post_link($html){
        $html = str_replace('<a','<a class="prev"',$html);
        return $html;
    function add_class_previous_post_link($html){
        $html = str_replace('<a','<a class="next"',$html);
        return $html;
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove rel from next_post_link’ is closed to new replies.