Support

Account

Home Forums ACF PRO acf_get_field_post must pull an item from latest data on Mysql 8

Unread

acf_get_field_post must pull an item from latest data on Mysql 8

  • When we upgraded our MySQL server from v5.7 to v8.0 version, our pages that uses field group that has a field type of ‘Flexible Content’ does not work anymore.

    On previous MySQL version (v5.7), this works fine. See the data of the group field attached to our page (because of previously removed field group):

    https://ibb.co/f88yN1x

    We temporarily added a manual work around to fix this issue. See highlighted changes we made to the ACF Pro V5.11.4.

    file: wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php

    
    function acf_get_field_post( $id = 0 ) {
     .....
    			// Query posts.
    			$posts = get_posts(
    				array(
    					'posts_per_page'         => 1,
    					'post_type'              => 'acf-field',
    					'orderby'                => 'id', // ordered by id 
    					'order'                  => 'DESC', // and must be in desc, so we retrieved the latest one
    					'suppress_filters'       => false,
    					'cache_results'          => true,
    					'update_post_meta_cache' => false,
    					'update_post_term_cache' => false,
    					"acf_field_$type"        => $id,
    				)
    			);
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.