Permalink
Browse files

Autolinks renderer - no self links

  • Loading branch information...
1 parent 7628076 commit 92acd9f1f955ef41ecf299b2fc4a5db6bf77e3c4 @yurabakhtin yurabakhtin committed Jan 9, 2017
Showing with 9 additions and 0 deletions.
  1. +9 −0 plugins/_autolinks.plugin.php
@@ -646,6 +646,8 @@ function make_clickable_callback( $text, $moredelim = '&' )
*/
function replace_callback( $matches )
{
+ global $disp, $Item;
+
$link_attrs = '';
if( $this->setting_nofollow_auto )
{ // Add attribute rel="nofollow" for auto-links:
@@ -695,6 +697,13 @@ function replace_callback( $matches )
return $r;
}
+ if( ( $disp == 'single' || $disp == 'page' ) &&
+ isset( $Item ) &&
+ $Item->get_permanent_url() == $url )
+ { // Do not make a link to same permalink URL of the current Item:
+ return $r;
+ }
+
if( !empty( $previous ) )
{ // This definitions is a group of two word separated with space
if( $this->previous_used || ( $this->previous_lword != $previous ) )

0 comments on commit 92acd9f

Please sign in to comment.