-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter content of pulled posts #1226
Comments
@IonTulbure You can use the <?php
namespace Distributor\Ticket\FilterPulledContent;
/**
* Modify the content of a post before it is pulled into the local site.
*
* @param array $post_args The post arguments passed to `wp_insert_post()` and `wp_update_post()`.
* @return array The modified post arguments.
*/
function modify_pulled_post_content( $post_args ) {
// Modify the post content.
$post_args['post_content'] = 'Modified content';
return $post_args;
}
add_filter( 'dt_pull_post_args', __NAMESPACE__ . '\\modify_pulled_post_content' ); This code runs on the site that the content is being pulled to, ie the site you visit to access the pull screen. |
@peterwilsoncc Hi. It works, much appreciated ! In case someone is interested. I filtered out the shorcode html with
|
Issue solved |
Describe your question
Hi. Posts on remote site have shortcodes which insert different html content into post body.
How can we filter post_content of pulled posts (both draft and published post with Distributor).
What action or filter to use for this scenario ? Where it is best to implement this, on the source site or the target one ?
I can strip the html tags with
preg_replace
onsave_post
hook but it will run for normal post inserts which isn't alright.Code of Conduct
The text was updated successfully, but these errors were encountered: