Skip to content

Instantly share code, notes, and snippets.

@girafffee
Last active February 20, 2025 17:05
Show Gist options
  • Save girafffee/2d24aa452f22c3cf2fa1cb9f579338e4 to your computer and use it in GitHub Desktop.
Save girafffee/2d24aa452f22c3cf2fa1cb9f579338e4 to your computer and use it in GitHub Desktop.
<?php
// https://gist.github.com/Crocoblock/3f33588881a09c0dd275f11aa00c973f
@M-FAPL
Copy link

M-FAPL commented Jan 12, 2023

Hi, I have no coding experience and I stumble upon your response in this link: https://wordpress.org/support/topic/media-and-wysiwyg-form-field-jetformbuilder-and-jet-engine-forms/

Can you show me how do you use this code to edit the WYSIWYG field to enable media upload?

Thank you.

@girafffee
Copy link
Author

Hi @M-FAPL, this is all you'll need:

$wysiwygConfig = function ( $wysiwyg_config ) {
	$wysiwyg_config['media_buttons'] = true;

	return $wysiwyg_config;
};

// for JetFormBuilder
add_filter( 'jet-form-builder/fields/wysiwyg-field/config', $wysiwygConfig );

// for JetEngine Forms
add_filter( 'jet-engine/forms/fields/wysiwyg-field/config', $wysiwygConfig );

and add it to functions.php of your child theme

@RodrigoMorgom
Copy link

Hi @M-FAPL, this is all you'll need:

$wysiwygConfig = function ( $wysiwyg_config ) {
	$wysiwyg_config['media_buttons'] = true;

	return $wysiwyg_config;
};

// for JetFormBuilder
add_filter( 'jet-form-builder/fields/wysiwyg-field/config', $wysiwygConfig );

// for JetEngine Forms
add_filter( 'jet-engine/forms/fields/wysiwyg-field/config', $wysiwygConfig );

and add it to functions.php of your child theme

HI @girafffee, thanks for sharing the code, is very Useful, But the icons for wrapping text around the image are not displayed. Some tip? Thanks!

@Andreas2209
Copy link

Hi @girafffee - thank you for this code! It works like a charm.
However i can´t get it working with a popup - the editor and field is there but i can´t set the cursor in the field...

@dshamsession
Copy link

Hi @girafffee

I also do not have experience...Can you show me how to use your code to edit the WYSIWYG field to disable just the paragraph button?

Thank you

@jurgendeveloper
Copy link

The code is great. Any ideas how to enable the Table option?

@brunocochito
Copy link

I think I managed to solve this.

In the TinyMCE folder of WordPress, the table plugin is not included. Using the same code as above, I did the following:

1- I downloaded the table module from this link: https://www.tiny.cloud/get-tiny/custom-builds/
I unzipped it and uploaded the "table" folder to /wp-includes/js/tinymce/plugins
(In this folder, all the plugins called in the first array are located). Therefore, naturally, TinyMCE in WordPress does not have the table plugin. But now, by manually uploading it, it does.

2- In the code above, I just added the plugin call in the first array ('table') and then called it after the "|" ('table').

Just save your code and boom... it's working!

The code is great. Any ideas how to enable the Table option?

@sakibstime
Copy link

I think I managed to solve this.

In the TinyMCE folder of WordPress, the table plugin is not included. Using the same code as above, I did the following:

1- I downloaded the table module from this link: https://www.tiny.cloud/get-tiny/custom-builds/ I unzipped it and uploaded the "table" folder to /wp-includes/js/tinymce/plugins (In this folder, all the plugins called in the first array are located). Therefore, naturally, TinyMCE in WordPress does not have the table plugin. But now, by manually uploading it, it does.

2- In the code above, I just added the plugin call in the first array ('table') and then called it after the "|" ('table').

Just save your code and boom... it's working!

The code is great. Any ideas how to enable the Table option?

Hi,
Thanks for your suggestion.

Step : I used the code through a code snippet.
Step 2: Uploaded the table folder in the wp-includes/js/tinymce/plugins directory.
Step 3: Added 'table' in plugins array & '|', 'table' in the toolbar_buttons array.

Getting this error " Failed to initialize plugin: table"

I checked the "Sources" from Inspect. The table/plugin.min.js file is loaded.

Any suggestions to resolve it?

@sakibstime
Copy link

I think I managed to solve this.
In the TinyMCE folder of WordPress, the table plugin is not included. Using the same code as above, I did the following:
1- I downloaded the table module from this link: https://www.tiny.cloud/get-tiny/custom-builds/ I unzipped it and uploaded the "table" folder to /wp-includes/js/tinymce/plugins (In this folder, all the plugins called in the first array are located). Therefore, naturally, TinyMCE in WordPress does not have the table plugin. But now, by manually uploading it, it does.
2- In the code above, I just added the plugin call in the first array ('table') and then called it after the "|" ('table').
Just save your code and boom... it's working!

The code is great. Any ideas how to enable the Table option?

Hi, Thanks for your suggestion.

Step : I used the code through a code snippet. Step 2: Uploaded the table folder in the wp-includes/js/tinymce/plugins directory. Step 3: Added 'table' in plugins array & '|', 'table' in the toolbar_buttons array.

Getting this error " Failed to initialize plugin: table"

I checked the "Sources" from Inspect. The table/plugin.min.js file is loaded.

Any suggestions to resolve it?

###UPDATE:
Finally worked for me after some some times later. Maybe I was facing cached issue. Worked both for regular page & JetPopup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment