• Looking for suggestions on how to fix a filter that’s part of a custom plugin. The filter modifies the_permalink and with changes in WP3.6 it no longer works. WP3.6 core now wraps the_permalink() in the esc_url() function.

    From /wp-includes/link-template.php:

    function the_permalink() {
         echo esc_url( apply_filters( 'the_permalink', get_permalink() ) );
    }

    The filter I have, maybe is a bit of a messy hack but did work up in prior WP versions, that appends ” target=”_blank” to the the_permalink based on a var set in the custom plugin,

    function append_link($the_permalink){
          global $win_target;
          if ($win_target != NULL){
               $the_permalink = $the_permalink . "\" target=\"" .$win_target;
          }
          return $the_permalink;
      }

    The esc_url() function is stripping out the double quote and space which ends up with just “target=_blank” tacked onto the end of the url.

    Thoughts on how I might repair this filter short of editing the core files or page templates.

    Thanks!

  • The topic ‘Filter to modify the_permalink not working WP3.6’ is closed to new replies.