Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active April 22, 2024 19:11
Show Gist options
  • Save tripflex/5e9024f7a949c423e8be3daea290e6c4 to your computer and use it in GitHub Desktop.
Save tripflex/5e9024f7a949c423e8be3daea290e6c4 to your computer and use it in GitHub Desktop.
WP Job Manager set TinyMCE to defaults (color picker, etc)
<?php
// This is my own personal modified version that I recommend
add_filter( 'submit_job_form_wp_editor_args', 'smyles_wpjm_wp_editor_wp_defaults', 99999 );
function smyles_wpjm_wp_editor_wp_defaults( $args ) {
$args['tinymce'] = array(
'plugins' => 'charmap,colorpicker,hr,lists,paste,tabfocus,textcolor,wordpress,wpautoresize,wplink,wpdialogs,wptextpattern,wpview,image',
'paste_as_text' => true,
'paste_auto_cleanup_on_paste' => true,
'paste_remove_spans' => true,
'paste_remove_styles' => true,
'paste_remove_styles_if_webkit' => true,
'paste_strip_class_attributes' => true,
'toolbar1' => 'formatselect,forecolor,bold,italic,removeformat,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_adv',
'toolbar2' => 'strikethrough,hr,pastetext,charmap,outdent,indent,undo,redo,wp_help',
'toolbar3' => '',
'toolbar4' => ''
);
return $args;
}
<?php
// These are the WordPress defaults (most stripped out by WPJM), this is really just for reference, I don't suggest using this one
add_filter('submit_job_form_wp_editor_args', 'smyles_wpjm_wp_editor_wp_defaults', 99999 );
function smyles_wpjm_wp_editor_wp_defaults( $args ){
$args['tinymce'] = array(
'plugins' => 'charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview,image',
'paste_as_text' => true,
'paste_auto_cleanup_on_paste' => true,
'paste_remove_spans' => true,
'paste_remove_styles' => true,
'paste_remove_styles_if_webkit' => true,
'paste_strip_class_attributes' => true,
'toolbar1' => 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,fullscreen,wp_adv',
'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
'toolbar3' => '',
'toolbar4' => ''
);
return $args;
}
@tripflex
Copy link
Author

Above are two files functions_wp_defaults.php where I basically just set everything back to the defaults that WordPress uses (which most of them WPJM stripped out). I don't recommend using that one.

The recommended one is the functions.php where I added things like color selector, clear formatting to the top toolbar. You can easily customize these yourself by moving them around as you wish (or remove all together)

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