Created
December 26, 2021 17:31
-
-
Save n7studios/81806c091894553c7b99479f97da4f38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WP to Buffer Pro: Remove URLs from Content and Excerpt Tags | |
* Plugin URI: http://www.wpzinc.com/ | |
* Version: 0.0.1 | |
* Author: WP Zinc | |
* Author URI: http://www.wpzinc.com | |
* Description: Remove URLs from Content and Excerpt Tags. | |
*/ | |
add_filter( 'wp_to_buffer_pro_publish_get_excerpt', function( $excerpt, $post ) { | |
return preg_replace( '/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $excerpt ); | |
}, 10, 2 ); | |
add_filter( 'wp_to_buffer_pro_publish_get_content', function( $content, $post, $is_gutenberg_post_content ) { | |
return preg_replace( '/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $content ); | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment