Support

Account

Home Forums Backend Issues (wp-admin) How to disable wp_autoresize_on for wysiwyg editor?

Solved

How to disable wp_autoresize_on for wysiwyg editor?

  • Since WordPress 4.0 the wysiwyg editor i WordPress automatically resizes the editor window to fit the text. If the editor window is taller than your browser and you scroll down, the toolbar will stay at top of the browser windows since it’s “sticky”. But the sticky toolbar does not work with ACF. So for every wysiwyg editor used there will be a lot of annoying scrolling if there is a lot of content.

    As a user you can solve this by unchecking the auto rezising option under the screen options panel. But what if you want to make this change permanent for all ACF wysiwyg editors?

    The wp_editor() function can pass settings to TinyMCE so I think it would be possible to set wp_autoresize_on to false when ACF calls wp_editor(). But I can’t find a way to make ACF pass this setting when adding a wysiwyg editor. Is it not possible?

    There is also the wp_editor_expand filter, but that would disable it for all wysiwyg editors and I just want to do it for ACF wysiwyg editors (since they lack the sticky toolbar). Is there a way to use this filter for ACF wysiwyg editors only?

  • Hi @adrian-b

    I’ve seen a lot of posts regarding the wysiwyg field as of late.. It would seem that ACF for some reason does not use wp_editor() to create the editor.. why that is I’m not sure but it could be simply because the wysiwyg field was introduced before wp_editor().

    I think I will take it up with elliot regarding possibly making the effort to switch to the native function rather than a custom editor.

  • Oh, I assumed ACF was using wp_editor(). Maybe I was confused by the ACF WordPress WYSIWYG Field.

  • Hmm.. I’m gonna have to take a second look at the field in core.

  • Alright so I took another quick look and I can’t find any reference to the native wp_editor in the included wysiwyg field in ACF Pro core.

  • Hello again,

    So I’ve talked to Elliot and the reason he’s not using wp_editor is that it’s not compatible with repeater and flexible fields.

    However there is a filter you can use to modify the tinyMCE settings in ACF

    acf.add_filter('wysiwyg_tinymce_settings', function( mceInit, id ){
    	
    	// do something to mceInit
    	
    	
    	// return
    	return mceInit;
    			
    });
  • Thank you Jonathan for your investigation. I was going to try your filter code, but after updating WordPress to 4.3 the problem is gone!

    I tested on two installations and saw the same thing on both. After updating WordPress to 4.3 the scrolling and fixed size of multiple ACF wysiwyg editors is back.

    (Before updating to WordPress I also updated ACF to 4.4.3 so it could be a combination of WP 4.3 and ACF 4.4.3, but only updating ACF did not change anything.)

    I’m going to mark this answer as “This solved my question” but I’m still thankful for your previous answers.

  • Hi Adrian,

    Alright good thing it worked out for you! Yeah in the latest ACF there has been some updates to the wysiwyg field in response to changes in WP 4.3 so that might be it.

    Good luck and feel free to post again if you have troubles with ACF.

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

The topic ‘How to disable wp_autoresize_on for wysiwyg editor?’ is closed to new replies.