ACF Custom Field WP_Query, but need to get all posts, if field doesn’t exist

You can get both with an OR meta_query that also checks if the key does not exist: ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘event_date’, ‘compare’ => ‘NOT EXISTS’, ), array( ‘key’ => ‘event_date’, ‘value’ => date(“Ymd”, time()), ‘compare’ => ‘>’, ), ), ‘orderby’ => array( ‘meta_value_num’ => ‘DESC’, ‘date’ => ‘ASC’, ),

Replace post’s “the_content” with ACF value

Instead of updating the post’s content, you can filter it using the the_content filter. add_filter( ‘the_content’, ‘wpse241388_use_acf_field’ ); function wpse241388_use_acf_field( $content ) { return get_field( ‘article_text’ ); } Update To apply to only your article post type: add_filter( ‘the_content’, ‘wpse241388_use_acf_field’ ); function wpse241388_use_acf_field( $content ) { if ( is_singular( ‘article’ ) ) { $content = … Read more

How to update custom taxonomy meta using ACF update_field() function or any other wordpress function

I figured it out somehow.. Syntax of update_field(): update_field($field_key, $value, $post_id) MY MISTAKE: I was using the wrong parameter for the $post_id which i thought was the Term Id of the custom taxonomy term. CORRECT USAGE: rather than using term id ($term_id in my question), one should use a string with the taxonomy preppended to … Read more

Get full image array

The “full array” is constructed by Advanced Custom Fields from various sources. It’s not a format that occurs natively in WordPress. If you want to output an image tag for an image with all the correct attributes, just use the ID with wp_get_attachment_image(). That returns an HTML <img> tag with the src, width, height, alt, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)