Support

Account

Forum Replies Created

  • If anyone else comes across a similar issue, the problem was that ACF now runs the WordPress sanitize_file_name() function on the JSON file names before saving them. That being said, I was using a different function that uses sanitize_file_name() to rename image files.

    The fix was to write a condition into my existing function:

    function image_hash_rename( $filename ) {
    	$info = pathinfo( $filename );
    	$ext  = empty( $info['extension'] ) ? '' : '.' . $info['extension'];
    
    	if ( '.json' === $ext ) { // output ACF JSON files in correct format
    	return $filename;
    	}
    
    	$name = basename( $filename, $ext );    
    	$hash = md5( $name );
        return date('m_d_y') . '_' . $hash . $ext;
    }
    add_filter( 'sanitize_file_name', 'image_hash_rename', 10 );

    After doing so, the JSON files are now being saved in the correct format and I was able to sync with them again.

    Thanks to Matt Shaw (WP Engine Support) for working through this with me and create a solution that worked.

  • Hi John, after thinking through the information you provided, I was in fact able to come up with an easy solution:

    
    $office_employees = get_users( array(
    	'meta_key' => 'office_name',
    	'meta_value' => 'Office 1',
    	'fields' => 'ID'
    ));
    
    $office_listings = get_posts(array(
    	'author__in'     => $office_employees,
    	'posts_per_page' => -1
    ));
    
    if( $office_listings ):
    	
    endif;
    

    Thanks!

  • Thanks for this information John, much appreciated.

    Maybe for now I will just manually add the User IDs to create a simple query for each office.

  • Thanks John, I have gone ahead and opened a support ticket as suggested.

Viewing 4 posts - 1 through 4 (of 4 total)