Skip to content

Instantly share code, notes, and snippets.

@coderaaron
Created March 12, 2020 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderaaron/f3318ff3523073c3b95b94d49898cc3c to your computer and use it in GitHub Desktop.
Save coderaaron/f3318ff3523073c3b95b94d49898cc3c to your computer and use it in GitHub Desktop.
<?php
$the_query = new WP_Query( array(
'post_type' => 'items',
'tax_query' => array(
array (
'taxonomy' => 'washu_ppi_items_types',
'field' => 'slug',
'terms' => 'apartments',
)
),
'posts_per_page' => -1
) );
$apartment_ids = array();
while ( $the_query->have_posts() ) :
$the_query->the_post();
// Show Posts ...
$a = apply_filters( 'the_content', get_the_content() );
$b = update_field( 'washu_ppi_summary', $a );
if ( true == $b ) {
echo get_the_ID() . ' update succesfully';
} else {
echo get_the_ID() . ' ERROR!';
}
endwhile;
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset.
*/
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment