Support

Account

Forum Replies Created

  • Sorry @martinko – Not had the time to implement all of John’s solution here. Would be interested if anyone else has come up with code for this.

  • I can also confirm this issue. ACF Wysiwyg field “Visual” editor content not displayed or editable on WP5.5+ (field displayed in an Sidebar position in the block editor, in this case). When Classic Editor plugin is installed, it works again.

  • Hi again –

    I can confirm that this problem is resolved with the premium Polylang Pro activated (rather than free Polylang plugin) and with Polylang license key activated.

    Thanks for your help
    Marcus

  • John –

    I have done some more testing here, and I can confirm that I see this problem behaviour with Relationship field and the Event Calendar tribe_events post type when the Polylang multilingual plugin is Enabled. I tried updating Polylang to latest version, and the problem still persists, so Polylang must be causing problems with the REST API query for post lookups in the Editor, I guess.

    I’ll see if I can see any way of overcoming this in Polylang settings.

    Thanks
    Marcus

  • Thanks for the pointers, John – let me have another look without some of the other Events Calendar plugins active.

  • Thanks for asking John

    When setting multiple post types as options in a Relationship field, tribe_events are not returned when searching posts from the fields. If I select Events to filter the posts, the Event posts do appear but do not save when selected.

    If only tribe_events are selected as the possible Post type for the Relationship field, all works as expected. The problem seems to occurs when tribe_event post type is available to the Relationship field alongside other post types.

  • Much appreciated, John. I’ll take another look.

  • Thanks for the pointer here, John – I think I’m really close to getting this to work.

    I am using an ACF field named surname_linked to create a relationship between one term in the surname custom taxonomy and another.

    The code below successfully adds a two way relationship between the taxonomy terms, but fails to remove taxonomy terms from the linked term when the term is removed.

    Maybe you can spot where I’m going wrong?

    /* Bi-directional Surname taxonomy term updating - to keep Surname terms in sync */
    function gwsfhs_bidirectional_acf_update_value( $value, $post_id, $field ) {
    
    	// vars
    	$field_name = $field['name'];
    	$field_key = $field['key'];
    	$global_name = 'is_updating_' . $field_name;
    	
    	// bail early if this filter was triggered from the update_field() function called within the loop below
    	// - this prevents an inifinte loop
    	if( !empty($GLOBALS[ $global_name ]) ) return $value;
    	
    	// set global variable to avoid inifite loop
    	// - could also remove_filter() then add_filter() again, but this is simpler
    	$GLOBALS[ $global_name ] = 1;
    	
    	// loop over selected posts and add this $post_id
    	if( is_array($value) ) {
    	
    		foreach( $value as $post_id2 ) {
    			
    			// load existing related posts
    			$value2 = get_field($field_name, 'surname_'.$post_id2, false);
    			
    			// allow for selected posts to not contain a value
    			if( empty($value2) ) {
    				$value2 = array();
    			}
          
          $prefix = 'term_';
          $post_id = preg_replace('/^' . preg_quote($prefix, '/') . '/', '', $post_id);
    			
    			// bail early if the current $post_id is already found in selected post's $value2
    			if( in_array($post_id, $value2) ) continue;
    			
    			// append the current $post_id to the selected post's 'related_posts' value
    			$value2[] = $post_id;
    			
    			// update the selected post's value (use field's key for performance)
    			update_field($field_key, $value2, 'surname_'.$post_id2);
    			
    		}
    	
    	}
    	
    	// find posts which have been removed
    	$old_value = get_field($field_name, 'surname_'.$post_id, false);
    	
    	if( is_array($old_value) ) {
    		
    		foreach( $old_value as $post_id2 ) {
    			
    			// bail early if this value has not been removed
    			if( is_array($value) && in_array($post_id2, $value) ) continue;
    			
    			// load existing related posts
    			$value2 = get_field($field_name, 'surname_'.$post_id2, false);
    			
    			// bail early if no value
    			if( empty($value2) ) continue;
    			
    			// find the position of $post_id within $value2 so we can remove it
    			$pos = array_search($post_id, $value2);
    			
    			// remove
    			unset( $value2[$pos] );
    		
    			// update the un-selected post's value (use field's key for performance)
    			update_field($field_key, $value2, 'surname_'.$post_id2);
    			
    		}
    		
    	}
    	
    	// reset global varibale to allow this filter to function as per normal
    	$GLOBALS[ $global_name ] = 0;
    	
    	// return
        return $value;
    }
    add_filter('acf/update_value/name=surname_linked', 'gwsfhs_bidirectional_acf_update_value', 10, 3);
  • +1 for this.

    I don’t know if you have checked out https://wordpress.org/plugins/acf-extended/ – it seems to add bidirectional relationships as a feature, but I’m not sure if this is between taxonomy terms or just between posts.

  • Same issue here. And posts do not seem to save if any of the Field Groups Titles that appear have required fields.

  • Many thanks for getting back on this, Elliot.

    I tried to take a look at this again, and the browser crashing issue when adding links in Text editor mode seems not to be occurring now. Could be something to do with a recent upgrade to WP 3.5.2, but we’ve seen this issue come and go in the past, so I’ll check in with the client to see if it’s all fixed.

    Thanks again
    Marcus

  • Hi Elliot – thanks for getting back to me.

    Yes, I’ve seen a couple of error in Firebug Console when trying to save a link from a Post in the HTML editor, but here’s the one that relates to ACF:

    NS_ERROR_FAILURE: Failure
    http://thepooka.org/wp-content/plugins/advanced-custom-fields/js/input.php?ver=4.1.8.1
    Line 461

    This seems to happen on first attempt to save a link in HTML mode, then I get the following error repeated for each subsequent time I try to save the link:

    NS_ERROR_FAILURE: Failure
    http://thepooka.org/wp-includes/js/wplink.min.js?ver=3.5.2
    Line 1

    This is in WP3.5.2 with latest ACF running, but I’ve also experienced the error on WP3.3.1 and on older versions of ACF version 3.

    Behaviour when trying to save a link in a post in HTML varies from browser to browser, but can often crash the browser tab altogether.

    Any help in resolving this would be appreciated. We use ACF to great effect on a number of sites, but see this issue repeatedly.

    Cheers
    Marcus

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