aderaaij
7/15/2014 - 10:03 AM

Remove the # anchor after more links

Remove the # anchor after more links

<?php
  function remove_more_tag_link_jump($link) {
      $offset = strpos($link, '#more-'); //Locate the jump portion of the link
      if ($offset) { //If we found the jump portion of the link
          $end = strpos($link, '"', $offset); //Locate the end of the jump portion
      }
      if ($end) { //If we found the end of the jump portion
          $link = substr_replace($link, '', $offset, $end-$offset); //Remove the jump portion
      }
      return $link; //Return the link without jump portion or just the normal link if we didn't find a jump portion
  }
   
  add_filter('the_content_more_link', 'remove_more_tag_link_jump'); //Add our function to the more link filter