Home / Admin / Add post meta if content has WP Tasty
Duplicate Snippet

Embed Snippet on Your Site

Add post meta if content has WP Tasty

This snippet will check if your migrated content has WP Tasty in it and if it has it will add a post meta to indicate that.

<10
Code Preview
php
<?php
add_filter( 'tasty_pins_old_attributes_migration_content', function ( $content, $post ) {
    if ( str_contains( $content, 'WP Tasty' ) ){
        update_post_meta( $post->ID, 'wp-tasty-here', true );
    }
    
	// You can also change $content to modify the contents of the post.
    return $content;
}, 10, 2 );

Comments

Add a Comment