Home › Forums › Feature Requests › Set WYSIWYG Height › Reply To: Set WYSIWYG Height
I had the same problem and applied my own solution:
new AcfTextarea();
class AcfTextarea
{
public function __construct()
{
add_action('acf/render_field_settings', [$this, 'addSettingsForWysiwyg']);
add_filter('acf/render_field/type=wysiwyg', [$this, 'preRenderWysiwygField'], 0, 1);
}
/* ---
Functions
--- */
public function addSettingsForWysiwyg($field)
{
if ($field['type'] !== 'wysiwyg') return;
acf_render_field_setting($field, [
'label' => __('Limit height of TinyMCE?', 'lang'),
'name' => 'wpf_tinymce_low',
'type' => 'true_false',
'ui' => 1,
], true);
}
public function preRenderWysiwygField($field)
{
if (!isset($field['wpf_tinymce_low']) || !$field['wpf_tinymce_low']) return;
ob_start();
add_filter('acf/render_field/type=wysiwyg', [$this, 'afterRenderWysiwygField'], 20, 1);
}
public function afterRenderWysiwygField($field)
{
remove_filter('acf/render_field/type=wysiwyg', [$this, 'afterRenderWysiwygField'], 20, 1);
$output = ob_get_contents();
$output = str_replace('height:300px;', 'height:100px;', $output);
ob_end_clean();
echo $output;
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.