Hi,
I have done some searching but couldn’t find anything that matched my particular issue.
I am having issues with ACF when using the pre_get_posts filter in my functions.php file.
I have following code that combines two posts types into the standard archive page.
function include_tweets_in_news_archive( $wp_query ) {
if ( !is_admin() && is_home() ) {
$wp_query->set( 'posts_per_page', 12 );
$wp_query->set( 'post_type', array( 'post', 'tweet' ) );
$wp_query->set( 'order', 'DESC' );
}
}
add_action( 'pre_get_posts', 'include_tweets_in_news_archive' );
Then on my archive page I am calling get_field to display a number of images that are created in ACF for an options page. The issue is is that regardless of what the return type for these image fields is set as (array, ID or URL) it always returns the image ID as a string.
On every other page that displays these fields it works fine and if I comment out that function it works fine on the archive page too, but I was wondering if anyone had experienced a similar issue or knew why it was happening.
For the time being I am checking whether or not it is a URL and if not then assuming it is an ID and loading the image that way, but this seems like a bug.
Cheers