Advertisement
arie_cristianD

disable override single post setting

Feb 19th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1.  
  2. function disable_override_setting( $post_id ) {
  3.     $post_meta                             = get_post_meta( $post_id, 'jnews_single_post' );
  4.     $new_post_meta                         = $post_meta;
  5.     $new_post_meta[0]['override_template'] = '0';
  6.     update_post_meta( $post_id, 'jnews_single_post', $new_post_meta );
  7. }
  8.  
  9. $args = array(
  10.     'post_type'      => 'post',
  11.     'posts_per_page' => -1,
  12. );
  13.  
  14. $query = new WP_Query( $args );
  15.  
  16. while ( $query->have_posts() ) {
  17.     $query->the_post();
  18.     disable_override_setting( get_the_ID() );
  19.  
  20. }
  21.  
  22. wp_reset_postdata();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement