Support

Account

Home Forums Backend Issues (wp-admin) WYSIWYG Toolbar options missing

Solving

WYSIWYG Toolbar options missing

  • I have a function to remove buttons from the ACF simple toolbar.

    function acf_simple_toolbar($toolbars)
    {
    	$remove = array('strikethrough','fullscreen','underline');
    	return array_diff($buttons,$remove);
    }
    add_filter('acf/fields/wysiwyg/toolbars','acf_simple_toolbar');

    In ACF PRO 5.2.1 this is causing the WYSIWYG “Toolbar” select to disappear from the admin area. If I comment it out and select “Basic” and then re-enable the function the full toolbar shows.

    This didn’t affect previous versions of ACF PRO. Am I doing something wrong or is this a bug?

  • Hi @redsun,

    Thanks for the post.

    This issue might be as a result of the code that you are using.

    Please try the following snippet which makes use of the unset() function:

    
    //removing fullscreen from basic toolbar
    if( ($key = array_search('fullscreen' , $toolbars['Full' ][2])) !== false )
    	{
    	    unset( $toolbars['Basic' ][2][$key] );
    	}
    
    	
    
    	// return $toolbars - IMPORTANT!
    	return $toolbars;
  • I sure wish you would fix the fullscreen problem! Annoying to have to code around this.
    For me, it turned out to be not the 2nd array, but the 1st. And for good measure, do the same thing for both Full and Basic. In your example you seem to be looking at ‘Full’ and then doing the unset to ‘Basic’. For us, it worked better like this:

    if( ($key = array_search('fullscreen' , $toolbars['Full'][1])) !== false )
    	{
    	
    	    unset( $toolbars['Full'][1][$key] );
    	}
    	
    	if( ($key = array_search('fullscreen' , $toolbars['Basic'][1])) !== false )
    	{
    
    	    unset( $toolbars['Basic'][1][$key] );
    	}
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.