TinyMCE not loading in IE8

The hook admin_init is to early for dequeuing, use wp_print_scripts, see examples in the Codex. define( ‘SCRIPT_DEBUG’, true ); will prevent combining dashboard scripts, so if that works for you on IE8, then do it for users with IE8: /** * True if user browser is IE8. */ $is_IE8 = preg_match( ‘/(?i)msie 8/’, $_SERVER[‘HTTP_USER_AGENT’] ); … Read more

TinyMCE custom button retrieve value from custom field

Rather than finding the custom field value when the user hits the button, change the [custom field value] to a shortcode name (perhaps “[mkay_subscription_button_value]”?) and then create a shortcode that can replace the value of that key with the post’s custom meta. Something like this: function 246286_display_custom_field( $atts ) { $data = get_post_meta( get_the_ID(), ‘mkay_custom_field’, … Read more

Custom styles in Tiny MCE with an external CSS file

The path to the CSS file tinymce.min.css was incorrect. The solution was to change: $url .= trailingslashit( plugin_dir_url(get_stylesheet_directory_uri()) ) . ‘/tinymce.min.css’; to: $StyleUrl = get_stylesheet_directory_uri().’/style-sheets/tinymce.min.css’; I also had to change: $StyleUrl = plugin_dir_url(get_stylesheet_directory_uri()).’tinymce.min.css’; to: $StyleUrl = get_stylesheet_directory_uri().’/style-sheets/tinymce.min.css’; Now all I had to do was to remove the styles array so the complete code is: // … Read more

WordPress wraps span tags into p tags

I have investigated this problem and recognized that it is not the TinyMCE fault, but the issue is caused by the the hook function wpautop instead. And tags are wrapped just before post is being displayed. So in order to fix this issue just remove the hook function like that. remove_filter( ‘the_content’, ‘wpautop’ ); This … Read more

Stop editor from adding “amp;” after every “&”

One solution is to hook into wp_insert_post_data and do some regex magic to replace all instances of & with &: // when saving posts, replace & with & function cc_wpse_264548_unamp( $data ) { $data[‘post_content’] = preg_replace( “/&/”, // find ‘&’ “&”, // replace with ‘&’ $data[‘post_content’] // target the ‘post_content’ ); return $data; } add_filter( … Read more

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