Request to change the post loop
-
Such a great idea for a plugin! I am seeing that this only scans the “post” post type though. You’ll need to change all occurrences of the get_posts() function to something like the following:
$post_types = get_post_types(array( 'public' => true, '_builtin' => false)); $post_types = array_merge($post_types, array("post", "page")); $posts = new WP_Query( array( 'posts_per_page' => -1, "post_type" => $post_types ) ); $count = 0; if ( $posts->have_posts() ) { while ( $posts->have_posts() ) { $posts->the_post(); $images = external_image_get_img_tags (get_the_ID()); if( !empty( $images ) ) { $posts_to_fix[$count]['title'] = get_the_title(); $posts_to_fix[$count]['images'] = $images; $posts_to_fix[$count]['id'] = get_the_ID(); } $count++; } } wp_reset_postdata();
The topic ‘Request to change the post loop’ is closed to new replies.