Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('wp',function (){
- $split_category=[
- 'category 1',
- 'category 2',
- ];
- $posts = get_posts(
- array(
- 'numberposts' => -1,
- 'post_status' => 'any',
- 'post_type' => 'post',
- )
- );
- foreach ($posts as $post) {
- $meta = get_post_meta($post->ID,'post_split');
- $categories=get_the_category($post->ID);
- foreach ($categories as $category) {
- if (in_array($category->cat_name,$split_category)) {
- $meta['enable'] = '1';
- update_post_meta($post->ID,'post_split',$meta);
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement