Support

Account

Home Forums Search Search Results for 'Wysiwyg'

Search Results for 'Wysiwyg'

reply

  • When I write something in the Wysiwyg Editor section and I update my post and after I refresh the page, the content has disappeared.

  • Here is my perspective on guberbug, can you tell by what I call it.

    I made the decision when it was first added that I will disable it and continue with ACF. There is nothing in ACF that should not work for the foreseeable future.

    WP is not changing its underlying functionality. Custom fields continue to work. Nothing in the database or anything to do with post/term/user meta is being changed.

    Guberbug puts everything involved with blocks into post_content. I don’t see that changing. Until they make a major over-hall of the DB I don’t see most of how WP works changing. This major over-hall is simply never going to happen because that would mean rebuilding WP from the ground up.

    Not only do I disable guberbug, but I also remove the classic editor from all post types as well and I only use ACF fields. This eliminates the possible future where WP disables classic editor on posts completely. They will continue, I believe, to allow post types to not support guberbug and for developers to build their own admins for custom post types. There are many examples of this in existing plugins where post types do not have content editors at all and depend on only custom fields. I also feel that ACF will always support a WYSIWYG editor in some form.

  • I’m still fumbling around with this a bit myself, not specifically with ACF blocks, but just my theme CSS in general. A couple of things I’ve done that have helped me along the way:

    1. I prepend main to my CSS selectors in my theme’s general CSS files. For example, in defining the style of my links, instead of just specifying a { } I am using main a { }. I did this primarily because I wanted to apply different styles to the body of my pages vs. the header and footer. (The HTML main tag is part of my templates… you may have a different selector you prefer to use… the point is to make sure it’s something that is always in the body of your front-end pages but not in the body of the Block Editor back-end pages.

    2. I have a bunch of general CSS for forms, contained in a form.css file in my theme. It was wreaking all kinds of havoc in the Block Editor until I realized I should not load it in the editor with the add_editor_style() function. At this point I don’t think I’ll ever have any form field elements in blocks, but… we’ll see.

    The reason I came to the forums today and stumbled upon this is something that may be tangentially related, collisions between ACF and updates to WP core. I noticed some of the ACF elements are laying out weird in the Block Editor, in ways that don’t seem to be related to my theme: the Visual/Text tabs in a WYSIWYG field were broken apart from the editor and too small; the draggable side columns in rows of a repeater are too narrow and the toggle button is partially hidden, etc. This appears to be due to some new handling of box-sizing in either ACF (I know they just did some CSS updates in a recent update) or WP core, or both.

  • @hube2 I have already set the WYSIWYG fields to delayed init.

    Yes, that’s what I noticed the hidden clone layout is being copied multiple times which makes the HTML so big.

    What are your suggestions here? Is there any alternative to the repeater field that is better performance-wise?

  • With huge numbers of fields there will be performance issues. If you have a lot of wysiwyg fields then you can set them to delayed init.

    All layouts will be generated at least once, even when not used. These are hidden and used when inserting a layout. The hidden “clone” layout is copied to the new instance.

  • When using a ACF WYSIWYG field the uploader used is the standard uploader used by WP. Any hooks you are looking for would be WP hooks that fire when a file is uploaded.

    Unfortunately I don’t have any idea what these hooks are and I have been unsuccessful at finding any information on this.

  • “Read more” in ACF text or wysiwyg field

  • unfortunately there is not a lot of documentation on customizing toolbars in the ACF WYSIWYG field. What does exist is here https://www.advancedcustomfields.com/resources/customize-the-wysiwyg-toolbars/

    You might try one of the results provided in this searh https://www.google.com/search?q=acf+add+controls+to+basic+wysiwyg+field

  • I just had the same issue, but for me the problem was that I had forgotten to give the WYSIWYG field within the repeater a title. ACF doesn’t prompt you to add a title if you forget, but then when you try to save content to that field, it silently fails.

    So, for anyone else facing this, double check that you’ve added a field title!

    I’m using the latest version of ACF Pro and WP, FWIW.

  • Hi serkanemir, I was able to get the iframe to function within the WYSIWYG field. Have you been able to work something out for your problem?

  • A non-JS option:
    Just swap out ‘company_detail’ for the name of your WYSIWYG field.
    And set/alter the length of the excerpt by changing the ’32’

    Nice and easy solution. Thanks for posting this.

  • Load time can be improved in the Admin for WYSIWYG editor fields using delayed or interaction triggered loading via a checkbox when using the Classic WYSIWYG Editor field

    Delay initialisation?
    TinyMCE will not be initialised until field is clicked.

    ACF field speed can be also be improved with local json
    https://www.advancedcustomfields.com/resources/local-json/
    Additionally you may want to explore using Transient caching:

    https://developer.wordpress.org/apis/handbook/transients/
    Hope this information helps your site performance.

  • There is a conflict, but I don’t know how to fix it. Have you tried contacting the other devs? Any plugin that can’t work with multiple WYSIWYGs is going to be a problem to use with ACF.

  • Actually when I click the ARVE button on a wysiwyg that’s a part of an ACF group it doesn’t even open, i get an error in the console “Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method ‘open'”. I guess that’s what you referring to?

  • On a site with just ACF and that plugin installed and using classic editor I am not seeing any problem, except when I add a field group with an ACF wysiwyg.

    I have not tried it with every field type.

  • What types of fields are on the page. I just tried it and it works fine as long as I don’t have a wysisyg field on the page. It doesn’t work at all if you do. This is likely because that plugin cannot handle multiple wysiwyg fields.

  • Hi John! Thanks for your response. For bug 2, there are actually 2 separate clone fields that clone the same field group. In my example, Header (component field group) and Footer (component field group) are 2 separate clone fields. I enabled prefix for both of them and that was where I saw the bug. Enabling prefix on the labels and field names gave me this setup:

    1. Content (block field group)
      1. Header (component field group)
        Prefix: Header

        1. Header Content Type (radio field)
          Field Name: header_content_type
        2. Header Content (wysiwyg field, shows if Header Content Type = “content”)
          Field Name: header_content
        3. Header Code (textarea field, shows if Header Content Type = “code”)
          Field Name: header_code
      2. Footer (component field group)
        Prefix: Footer

        1. Footer Content Type (radio field)
          Field Name: footer_content_type
        2. Footer Content (wysiwyg field, shows if Footer Content Type = “content”)
          Field Name: footer_content
        3. Footer Code (textarea field, shows if Footer Content Type = “code”)
          Field Name: footer_code

    The base field group for the component has these fields without the prefixes:

    1. Content (component field group)
      1. Content Type (radio field)
        Field Name: content_type
      2. Content (wysiwyg field, shows if Content Type = “content”)
        Field Name: content
      3. Code (textarea field, shows if Content Type = “code”)
        Field Name: code
  • I’ve tried the code below. But this just returns the Full toolbar without the desired extra dropdown menu.

    add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
    
    function my_toolbars( $toolbars ) {
    	$style_formats = array(  
    		array(
    			'title' => 'My style',
    			'block' => 'span',
    			'classes' => 'mystyle',
    			'wrapper' => true,
    		),
    	);
    
    	$toolbars['My toolbar'] = $toolbars['Full'];
    	$toolbars['My toolbar'][1]['styleselect'] = json_encode( $style_formats );
    
    	return $toolbars;
    }
  • I turned off all plugins (save ACF) and it does the same thing. I switched to WYSIWYG instead of text area and the behaviour is the same.

    This is only happening in ACF, p and br behave as expected in the post’s regular body copy.

    ETA:

    Actually, I misdiagnosed the issue. It’s not that ACF is turning p into br+br. Rather, it is stuck on “auto br” and it not honoring changes to that new line value even though it will say “auto p” or “no formatting”

    I duplicated as ‘fieldname2’ and with the same text copied, it works as it should.

    So how can I unstick this?

  • ACF automatically runs a number of filters on the content and does not have any way to avoid this for only a single WYSIWYG field. The only way to do this would be to get the value unformatted

    
    get_field('wysiwyg_field_name', false, false);
    // or 
    get_sub_field('wysiwyg_field_name', false);
    

    and then apply each of the filters yourself in the correct order with the exception of ‘wpautop’

    From ACF code

    
    
    		function add_filters() {
    
    			// WordPress 5.5 introduced new function for applying image tags.
    			$wp_filter_content_tags = function_exists( 'wp_filter_content_tags' ) ? 'wp_filter_content_tags' : 'wp_make_content_images_responsive';
    
    			// Mimic filters added to "the_content" in "wp-includes/default-filters.php".
    			add_filter( 'acf_the_content', 'capital_P_dangit', 11 );
    			// add_filter( 'acf_the_content', 'do_blocks', 9 ); Not yet supported.
    			add_filter( 'acf_the_content', 'wptexturize' );
    			add_filter( 'acf_the_content', 'convert_smilies', 20 );
    			add_filter( 'acf_the_content', 'wpautop' );
    			add_filter( 'acf_the_content', 'shortcode_unautop' );
    			// add_filter( 'acf_the_content', 'prepend_attachment' ); Causes double image on attachment page.
    			add_filter( 'acf_the_content', $wp_filter_content_tags );
    			add_filter( 'acf_the_content', 'do_shortcode', 11 );
    
    			// Mimic filters added to "the_content" in "wp-includes/class-wp-embed.php"
    			if ( isset( $GLOBALS['wp_embed'] ) ) {
    				add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
    				add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
    			}
    		}
    
  • I was able to view the video.

    You cannot put PHP code in a wysiwyg. You cannot use a shortcode as an attribute of an html tag. In addition to this if you are attempting to use a shortcode then the ACF field must be attached to the same post as the content. If you want to use a file field and insert and iframe in a wysiwyg field then you will probably need to build your own shortcode to do it. Beyond this I’m not 100% sure what you are trying to do, or where the fields are, or how that location relates to the post where you are attempting to insert the iframe.

  • This does fix the media chooser issue but causes the Gravity Forms Add Form button to disappear from the WYSIWYG field.

  • There are a couple of options.

    One way to do this is to create an acf/save_post action with a priority of < 10. In this action you can compare the old value in the field get_field('file_field') with the new value submitted $_POST['acf']['field_KEY'] and if they are different then use wp_delete_attachment() to delete the old file. This will only work after a post has been saved. So if someone adds a file and then changes their mind before saving then the file will not be deleted.

    A variation of the above (still using an acf/save_post action) would be get all of the attachments for the post being saved https://stackoverflow.com/questions/42917812/how-to-get-all-attachments-for-a-wordpress-post. All files uploaded in an ACF field should be attached to the post. Then look in every field that is for an attachment (file, image, gallery) and get a list of the ones actually being used and delete the ones that are not. The flaw in this method is that you will not be able to detect files or images that are added in the WP editor or a WYSIWYG field and you’d end up deleting these.

    Another way that this could be done is to add custom JavaScript to ACF and add an action to the remove button that fires an AJAX request to delete the file. This would be the best solution, but also the hardest to accomplish.

    There is another flaw with every method, you will not know if the same file has been used on another post. Deleting the file if it is used somewhere else will cause issues with wherever else it is used.

  • I am not having any issues with WYSIWYG fields, either in repeaters or out.

    Have you tried a different theme?

    Are you seeing any JS errors on the page?

Viewing 25 results - 226 through 250 (of 1,299 total)