Open a Thickbox with content trough AJAX

The second parameter for tb_show is the URL, so you’ll want to use something like.. <?php $ajax_url = add_query_arg( array( ‘action’ => ‘getTheContent’, ‘query_var1’ => ‘value1’, ‘query_var2’ => ‘value2’ ), admin_url( ‘admin-ajax.php’ ) ); ?> tb_show(tag, ‘<?php echo $ajax_url; ?>’ ); I’d guess you need to pass the action and any additional query vars manually(as … Read more

How to use wpLink without editor?

There is not ethical way of doing this. But still there is a way to do this. WordPress wrote wpLink script keeping in mind that editor is there but still WordPress handle when editor is not there (Good Thing) Consider this example and assume that we are using it on front-end in footer. First enqueue … Read more

Disable Visual editor for all users

The easiest way seems to be to use the Disable Visual Editor Plugin. The plugin also recommends that you remove the wp-includes/js/tinymce/ directory, but will require maintenance every upgrade.

Forcing reload of editor-style.css

There is a hook for that: ‘mce_css’. It is called in _WP_Editors::editor_settings() and you get all loaded stylesheets comma separated as the first and only parameter. Now it is easy: Use the global variable $editor_styles (here are your theme’s and parent theme’s editor stylesheets stored already), add the time of the file’s last modification as … Read more

Admin: very slow edit page caused by core meta query

If you want to test your custom SQL to see how it affects the loading time, you can try this query swapping: /** * Restrict the potential slow query in the meta_form() to the current post ID. * * @see http://wordpress.stackexchange.com/a/187712/26350 */ add_action( ‘add_meta_boxes_post’, function( $post ) { add_filter( ‘query’, function( $sql ) use ( … Read more

Extra TinyMCE editor strips and tags?

I recently got this working. You should search and replace metaname with your meta box name. The key to maintaining formatting was using wpautop(); when saving the data. add_action( ‘add_meta_boxes’, ‘add_metaname_box’); add_action( ‘save_post’, ‘metaname_save’); function add_metaname_box() { add_meta_box( ‘metaname_id’, __( ‘metaname text’, ‘metaname_textdomain’), ‘metaname_custom_box’, ‘page’ ); } function metaname_custom_box() { global $post; wp_nonce_field( plugin_basename( __FILE__ … Read more

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