remove hyperlinks in a wordpress post
Insert the php code below into the theme_functions.php file, which is stored in the folder yoursite.com/wp-content/themes/theme-name/functions/
Don't forget to comment it before inserting it into the file, so you'll understand later what you inserted.
Code to insert
/*function to remove links from images in news posts - when viewing the full text*/
add_filter( ‘the_content’, ‘link_remove_filter’ );
function link_remove_filter( $content ) {
$content =
preg_replace(
array('{
]*>
'{ wp-image-[0-9]*» />}'),
array('
![]()
'),
$content
);
return $content;
}
the code doesn't work, and even if it does work, not always
put a stub in the template so the links don't trigger, for example something like this
yes, it's a bit hacky, but it works
Comments