Created
October 29, 2019 13:13
-
-
Save n7studios/06b8da8f2d9837a6422863ae62e774e8 to your computer and use it in GitHub Desktop.
WordPress to Buffer Pro: Append Forwardslash to Permalink
This file contains hidden or 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: Append Forwardslash to Permalink | |
* Plugin URI: http://www.wpzinc.com/ | |
* Version: 0.0.1 | |
* Author: WP Zinc | |
* Author URI: http://www.wpzinc.com | |
* Description: Modify the {url} output, ensuring it has a final forwardslash immediately before it is sent to Buffer. | |
*/ | |
/** | |
* Modify the {url} output, ensuring it has a final forwardslash immediately before it is sent to Buffer. | |
* | |
* @since 0.0.1 | |
* | |
* @param array $searches_replacements Registered Supported Tags and their Replacements | |
* @param WP_Post $post WordPress Post | |
* @return array Registered Supported Tags and their Replacements | |
*/ | |
function wp_to_buffer_publish_register_post_searches_replacements( $searches_replacements, $post ) { | |
$searches_replacements['url'] = get_permalink( $post->ID ); | |
return $searches_replacements; | |
} | |
// Filter for Free version of Plugin | |
add_filter( 'wp_to_buffer_publish_register_post_searches_replacements', 'wp_to_buffer_publish_register_post_searches_replacements', 10, 2 ); | |
// Filter for Pro version of Plugin | |
add_filter( 'wp_to_buffer_pro_publish_register_post_searches_replacements', 'wp_to_buffer_publish_register_post_searches_replacements', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment