TinyMCE removes iframe attributes width and height

[*] This took me ages to figure out but here is how it works now just add below code to the functions: function tinyMCEoptions($initArray) { $options=”*[*]”; $initArray[‘valid_elements’] = $options; $initArray[‘extended_valid_elements’] = $options; return $initArray; } add_filter(‘tiny_mce_before_init’, ‘tinyMCEoptions’); [*]

How to make WordPress and TinyMCE accept tags wrapping block-level elements as allowed in HTML5?

[*] A few years down the track, but hopefully someone else will find this solution useful… Although my issues trying to get this sort of thing to work in WordPress were slightly different, hopefully this solution will work for you too. Firstly, the issue with tags not being allowed to contain multiple block level elements … Read more

TinyMCE – Show Advanced Options (2nd Row) By Default

If you inspect the value of $in you should get something like: Array ( [mode] => exact [width] => 100% [theme] => advanced [skin] => wp_theme [language] => en [theme_advanced_toolbar_location] => top [theme_advanced_toolbar_align] => left [theme_advanced_statusbar_location] => bottom [theme_advanced_resizing] => 1 [theme_advanced_resize_horizontal] => [dialog_type] => modal [formats] => { alignleft : [ {selector : ‘p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li’, … Read more

Using post ID in custom tinyMCE button

You would need to place a globally namespaced javascript variable in your php code where you enqueue the script to be loaded for the editor pages. So, this code will enqueue a script function to be added to the “edit post/page” screens: add_action(‘admin_head’,’my_add_styles_admin’); function my_add_styles_admin() { global $current_screen; $type = $current_screen->post_type; if (is_admin() && $type … Read more

Adding TinyMCE custom buttons when using teeny_mce_before_init

I believe that you have already registered your shortcode. Now what we need to do is to initiate the Button. Once the shortcode is registered [ph_min] let’s check if user can use rich editing: function add_highlight_button() { if ( ! current_user_can(‘edit_posts’) && ! current_user_can(‘edit_pages’) ) return; if ( get_user_option(‘rich_editing’) == ‘true’) { add_filter(‘mce_external_plugins’, ‘add_tcustom_tinymce_plugin’); add_filter(‘mce_buttons’, … Read more

Registering custom TinyMCE buttons, for admin area, to work with custom instances of wp_editor

I copied your code into my functions.php, and added a simple admin panel (‘Foo’) to display the editor. Then I created a new directory inside my current theme for the editor button, and put the editor button JS into the relevant file: /wp-content/themes/[my-theme-dir]/tinymce_buttons/pH/editor_plugin.js. Result: when I went to Dashboard > Foo (the panel I’d created), … Read more

data-accordion removed in Visual Editor

Here is an example of How to Update kses and TinyMCE to allow select data-* attributes in WordPress. Reference add_action( ‘after_setup_theme’, ‘x_kses_allow_data_attributes_on_links’ ); function x_kses_allow_data_attributes_on_links() { global $allowedposttags; $tags = array( ‘a’ ); $new_attributes = array( ‘data-foo’ => array(), ‘data-bar’ => array(), ); foreach ( $tags as $tag ) { if ( isset( $allowedposttags[ $tag … Read more

TinyMCE Editor Set Default Tab

I came across this page — http://wp-snippets.com/set-default-editor/ * — which looks promising, though a little out of date. Instead of their code, I would suggest trying this: add_filter( ‘wp_default_editor’, ‘wpse101200_default_editor’ ); function wpse101200_default_editor( $editor ) { return ‘tinymce’; } Reference WPSeek’s wp_default_editor() page wp_default_editor() in the WordPress core source Unfortunately, the Codex doesn’t currently have … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)