Support

Account

Forum Replies Created

  • Thanks @vivyane-fernando. I cleaned out a wonky function in my custom theme and now all problems seem resolved for now although I didn’t retest with Twenty-twenty theme. Custom posts showing up and saving again with custom theme so that’s the important thing for now.

  • I’m having the same problem. Custom post type not showing up in select list. Tried including taxonomy too per this post https://support.advancedcustomfields.com/forums/topic/post-object-field-no-matches-found/ but that didn’t help. Nothing in debug log. Running Twenty-theme (with only ACF Pro and CPT UI active plugins) as am already trying to debug why Post Object field was showing multiple select fields and then not saving any selection in custom theme. Any suggestions?

  • I’m having the same problem now. Using ACF PRO 5.8.8 and the posts that are supposed to show up in my Post Object field are showing up in the dropdown (they were definitely there before, site is nearly 2 years old; not sure when they stopped). Only one random post shows up when I click the select.

  • Not quite working. The original validates or throws the error but not the clone; tried to with the acf_add_validation_error function using acf[field_5d5b156507abc][field_5d5b156507abc_field_5d49b34a396b7] which is how it seems to be indexing but no luck.

  • RE: acf-quick-edit-fields — it can’t add Post Object fields to Bulk Edit.

  • Thanks @beee — repeater was NULL on some pages, neglected to include the pre-repeater-loop sort in the if statement.

  • Getting the same errors — and using name of field, not the key, so that’s not the problem/solution. Function runs, and sorts as intended, but would be nice to not have those errors.

  • I’m having the same problem too. 5.7.2 won’t update to 5.7.3 on staging site even after re-entering license.

  • The posts_join worked. Posting code below in case it helps anyone else.

    $args = array(
    	'post_type'         => 'artworks',
    	'posts_per_page'    => -1,
    	'no_found_rows' 	=> true,
    	'order'				=> 'ASC',
    	'orderby'			=> 'artist_name_artwork_title',
    );
    
    add_filter('posts_join', 'test_join', 10, 2 );
    function test_join($joins, $wp_query) {
    	if ( $wp_query->get( 'orderby' ) != 'artist_name_artwork_title' ) {
    		return $joins;
    	}	
    	global $wpdb;        
    	$joins .= "  LEFT JOIN $wpdb->postmeta name ON name.post_id=$wpdb->posts.ID AND name.meta_key='artists_name'" ;
    	$joins .= "  LEFT JOIN $wpdb->postmeta lastname ON lastname.post_id=name.meta_value AND lastname.meta_key='artist_last_name'";
    	$joins .= "  LEFT JOIN $wpdb->postmeta firstname ON firstname.post_id=name.meta_value AND firstname.meta_key='artist_first_name'";
    	return $joins;
    }
    
    add_filter('posts_orderby', 'orderby_artist_name_artwork_title', 10, 2);
    function orderby_artist_name_artwork_title($orderby_statement, $wp_query) {
    	if ( $wp_query->get( 'orderby' ) != 'artist_name_artwork_title' ) {
    		return $orderby_statement;
    	}	
    	global $wpdb;        
    	$orderby_statement = "lastname.meta_value, firstname.meta_value, $wpdb->posts.post_title";
    	return $orderby_statement;
    }
    
    $wp_query = new WP_Query( $args );
    		
    remove_filter('posts_join', 'test_join', 10 );
    remove_filter('posts_orderby', 'orderby_artist_name_artwork_title', 10 );
  • Read that post. Unless I’m missing something, that would still only save a wp field value when Post Type A is saved/updated and that value wouldn’t be dynamically updated if ever it was changed in Post Type B?

  • Also, another problem with duplicating field values into Post Type A from Post Type B: those fields in Post Type A won’t reflect any changes made to that field in Post Type B. (E.g. I can load ‘last_name’ from Post Type B when creating or updating Post Type A; but it won’t dynamically update if Post Type B ever updates that field.) That’s why the posts_join seems like it might be the solution without slowing down the site too much.

  • Thanks, @hube2. I was afraid of that. I do have the values from “Post Type B” loading into fields in a few posts of “Post Type A” using acf/load_value but would then have to go back and update all posts in “Post Type A” to get those values loading in the database. Thought I would exhaust the posts_join option before doing that since it seemed similar in concept to the acf/post-object/query filter. (And is there a way to bulk update all the posts of “Post Type A”?)

  • Meanwhile, I’ve converted the Relationship field to a Post Object field since each Artwork only has one Artist associated with it. That has this post object query filter:

    function artist_post_object_query( $args, $field, $post_id ) {
    $args['meta_query'] = array(
        'relation' => 'AND',
        'last_name' => array(
            'key' => 'artist_last_name'
    	),
         'first_name' => array(
    	'key' => 'artist_first_name'
          ));
          $args['orderby']	= array(
    	'last_name' => 'ASC',
    	'first_name' => 'ASC'
    	);	
        // return
        return $args;
    }
    add_filter('acf/fields/post_object/query/name=artists_name', 'artist_post_object_query', 10, 3);

    So Artist correctly alphabetized in the Artwork edit screen. (Although that filter doesn’t extend to the List screen sort order, for which I’m using Admin Columns Pro.)

    Essentially I want that filter to work any time the Artworks field ‘artist_name’ is being used as a meta_key to sort so that ‘meta_value’ can be replaced with ‘artist_last_name’ + ‘artist_first_name’ instead of the post ID. It seems like a posts_join and then posts_orderby filter would work but I can’t get this join to work:

    add_filter('posts_join', 'artist_join', 10, 2 );
    function artist_join($joins)
    {
        if(is_post_type_archive('artworks') || (is_admin() && $_GET['post_type'] == 'artworks')) {
            global $wpdb;        
            $joins .= "  INNER JOIN {$wpdb->postmeta} pm_last_name ON pm_last_name.post_id={$wpdb->posts}.ID
           WHERE pm_last_name.meta_key='artist_last_name'" ;
            $joins .= "  INNER JOIN {$wpdb->postmeta} pm_first_name ON pm_first_name.post_id={$wpdb->posts}.ID
           WHERE pm_first_name.meta_key='artist_first_name'" ;
        }
        return $joins;
    }

    Any help would be much appreciated.

  • Did you get this to work? I had a similar problem that stumped me for days. Instead of:

    'value' => '"' . get_the_ID() . '"',

    this worked:

    'value' => get_the_ID(),

  • Ditto what @yeetien said — would be nice to be able to resize while retaining ability for user to drag to adjust.

  • I’m having the same problem–the main content is being replaced with a WYSIWYG field. I have 3 custom WYSIWYG fields, using both Basic and Full toolbar, none of which allow images. Seems to be the same situation for me — the replacement happens after editing and updating the WYSIWYG in full screen mode. Will try to verify a pattern as well.

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