Support

Account

Forum Replies Created

  • Yep, that did the trick. πŸ‘πŸ»

  • Thanks for sharing the solution. This has always been a pain (a client getting stuck in “edit” mode on a block with inner blocks) and I’m glad it can now be solved.

  • I’ve been in touch with support via email and shared a video of the issue. Sounds like it’s a bug – they were able to replicate it. Hopefully will be addressed quickly.

  • Seems like this might be limited to textareas on nav menu items. I can save <svg> code just fine if I add it to a textarea in other locations, like on a Post.

  • I suspect it was version 6.0.4 that introduced this sanitization based on the change log: https://www.advancedcustomfields.com/blog/acf-6-0-4/

  • @winston-grace Yep. I discovered that inner blocks are not allowed to use certain alignments – which is very frustrating, but not ACF’s fault. It’s a design decision by the Gutenberg team.

  • I’ve been experiencing this same issue. Wide and Full do not display in the dropdown menu even if they are specified. Only center, left and right will display.

  • Gah. Totally figured it out. I had some styles setup to hide the block-list-appender unless the block was selected. This was on the parent block and was also applying to children. /facepalm

  • Hmmm… actually it’s working in some cases but not in others. If I uncover why I’ll followup here.

  • I am running into this same issue on a site with only a couple of embeds.

  • Well, I may have just solved the issue for myself after reviewing what I pasted above. In acf_register_block_type I was using a script name (apm-quote-slider) that I was using for a different script. After updating that to a unique name for this script the problem seems to be resolved.

  • Side note: When this ACF block is included in a block pattern the callback does not fire for the block pattern preview. So it shows stacked images rather than the slider. If I add that block to the page then reload the block pattern preview then looks as it should (shows the slider).

  • I’m having this same issue. Using slick slider instead of owl. When I add images to either a repeater or gallery the callback does not fire. Here’s my JS. Some of the slider logic is imported, but that doesn’t seem to be the issue. It won’t even console log the message and date I’ve got setup.

    Now, if I save the page and reload the editor then things seem to work fine. The callback fires and the slider properly initializes. It’s only when a new block is added and edited that this problem appears.

    
    import { default as sliders } from "../../../assets/src/js/modules/_sliders.js";
    
    (function ($) {
    
    	/**
    	 * initializeBlock
    	 *
    	 * Adds custom JavaScript to the block HTML.
    	 *
    	 * @date    15/4/19
    	 * @since   1.0.0
    	 *
    	 * @param   object $block The block jQuery element.
    	 * @param   object attributes The block attributes (only available when editing).
    	 * @return  void
    	 */
    	var initializeBlock = function( $block ) {
    
    		var d = new Date();
    		var n = d.toLocaleTimeString();
    
    		console.log( 'setup sliders on back end ' + n );
    
    		var slider = $block[0].querySelector(".js-image-slider");
    
    		if (slider) {
    			sliders.setupImageSlider(slider);
    		}
    
    	}
    
    	// Initialize each block on page load (front end).
    	$(document).ready(function () {
    
    		const imageSliders = document.querySelectorAll(".js-image-slider");
    
    		if (imageSliders) {
    			imageSliders.forEach(element => {
    				sliders.setupImageSlider(element);
    			});
    		}
    
    	});
    
    	// Initialize dynamic block preview (editor).
    	if (window.acf) {
    		window.acf.addAction('render_block_preview/type=image-slider', initializeBlock);
    	}
    
    })(jQuery);
    
    
           acf_register_block_type( array(
            'name'            => 'image-slider',
            'title'           => __( 'Image slider', 'apm-theme' ),
            'description'     => __( 'Displays an image slider', 'apm-theme' ),
            'render_template' => 'blocks/acf-image-slider/acf-image-slider.php',
            'category'        => self::get_block_category('slug'),
            'mode'            => 'preview',
            'enqueue_assets' => function() {
              APM_Theme::enqueue_vendor_resources( 'slick' );
              wp_enqueue_script( 'apm-quote-slider', get_template_directory_uri() . '/blocks/acf-image-slider/assets/acf-image-slider.min.js', array('jquery', 'slick'), '', true );
            },
           ) );
    
  • Make sure to pass the post ID to get_the_post_thumbnail_url()

    In a block you can simply reference $post_id to get it.

    get_the_post_thumbnail_url($post_id)

  • Also noticing this behavior. Seems counter to what it should do (or at least two what I’d expect it to do), which is for the default alignment to honor the value of the specified align property.

    When set to full, blocks seem to not be displaying as full. I still have to click the full icon – which means I also have to leave that icon visible.

    Ideally I’d be able to set the default alignment to full and also disable the icon bar.

  • Just adding the QueryMonitor debug output for reference (see attached). Happy to share additional details if helpful.

  • I am experiencing the same issue after upgrading from 5.7.10 to 5.8.0.

    Like the original author of this post, I use flexible layout fields, cloning other field groups in for each layout option.

  • Yes, please do what Delicious Brains does for WP Migrate DB Pro. Allow us to set a constant in the wp-config file. See:

    https://deliciousbrains.com/wp-migrate-db-pro/doc/activating-license/

  • +1 to being able to choose rgb or hex for output

  • +1 for being able to just set a config constant for the license key.

    I have a shell script that uses wp cli to setup (or tear down) my development environments quickly and efficiently. ACF is one of the standard plugins I include in that process. WP Migrate DB Pro as well. DelicousBrains allows you to simply define a constant in the config file for the plugin license key. This allows me to easily add that constant via wp cli when creating the environment.

    https://deliciousbrains.com/wp-migrate-db-pro/doc/activating-license/

    Needing to manually add the key for ACF is a step that would be nice to eliminate.

  • I’m not sure if this is THE solution. I’d absolutely love to NOT have to manually update the Taxonomy, but have ACF handle it – like it seems it should do? Totally may be user error for why it’s not.

    I’m manually saving the taxonomy using wp_set_object_terms(). In this case the user is restricted to selecting a single term. The solution would look a bit different if multiple terms were allowed.

    
    function acf_post_save_tribute( $post_id ) {
    	
    	// bail early if not a tribute
    	if( get_post_type($post_id) !== 'tribute' ) {
    		return;
    	}
    
    	// bail early if wordpress admin
    	if( is_admin() ) {
    		return;
    	}
    	
    	// get step
    	$trib_step = get_field('trib_step', $post_id);
    	
    	// create/update the post title if this is a new post or if the user has edited step 1
    	if ( $trib_step <= 1 ) {
    		$args = array(
    			'ID' 		 => $post_id,
    			'post_title' => $_POST['acf']['field_558884854c6ce'] . ' ' . $_POST['acf']['field_558884974c6cf'],
    		);
    		wp_update_post($args);	
    		
    		// manually update the state taxonomy field
    		$the_term_obj = get_term($_POST['acf']['field_5591b6e43e1b7'], 'trib_state');
    		$the_term_slug = $the_term_obj->slug;
    		wp_set_object_terms($post_id, $the_term_slug, 'trib_state');
    	}
    
    	// redirect new tributes to step 2 and pass along the proper ID
    	if ($trib_step < 1) {
    		$redirect = get_tribute_editor_url(2,$post_id);
    		wp_redirect($redirect);
    		exit;		
    	}
    
    }
    
  • Narrowing it down here…

    The problem is in the use of acf/save_post.

    Quick overview: I have a multi-step process setup for creating a tribute (custom post type). First form creates the post (a custom post type). Next forms are for adding additional meta data. To get users to step 2, I am using the acf/save_post action to redirect them (back to the editor) after the post is created. However, using this action is preventing the custom taxonomy (states) from saving. It saves the text fields just fine.

    function get_tribute_editor_url($trib_step=false,$trib_id=false) {
    	
    	$url = site_url() . '/edit-tribute/';
    	
    	if ($trib_step && $trib_id) {
    		$url .= "?trib_step=$trib_step&trib_id=$trib_id";	
    	}
    	
    	return $url;
    }
    
    function acf_post_save_tribute( $post_id ) {
    	
    	// bail early if not a tribute
    	if( get_post_type($post_id) !== 'tribute' ) {
    		return;
    	}
    	
    	// get step
    	$trib_step = get_field('trib_step', $post_id);
    	
    	// create/update the post title if this is a new post or if the user has edited step 1
    	if ( $trib_step <= 1 ) {
    		$args = array(
    			'ID' 		 => $post_id,
    			'post_title' => $_POST['acf']['field_558884854c6ce'] . ' ' . $_POST['acf']['field_558884974c6cf'],
    		);
    		wp_update_post($args);
    	}
    
    	// redirect	new tributes to step 2 and pass along the proper ID
    	if ($trib_step < 1) {
    		$redirect = get_tribute_editor_url(2,$post_id);
    		wp_redirect($redirect);
    		exit;		
    	}
    }
    add_action( 'acf/save_post', 'acf_post_save_tribute', 20);
    
  • Wondering if it’s a problem with the taxonomy not being registered at the time the post is saved? Seems that everything should be registered at that stage – looking into that today.

    The taxonomy field is set to load/save with the actual taxonomy.

  • I’d like to disable select2-search on all select menus. Specifically on front-end forms, but also fine if disabled in the admin area as well.

    In my case the menus are fairly short and there’s just no need for search. I could potentially just hide it with CSS, but it seems that disabling it from appearing at all would be the better route.

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