Is there an event or an other method that tells me the preview is loaded?

Yes, this is the way to detect when the preview has loaded: wp.customize.bind( ‘ready’, function() { wp.customize.previewer.bind( ‘ready’, function( message ) { console.info( ‘Preview is loaded’ ); } ); } ); This JS code should be enqueued at the customize_controls_enqueue_scripts action with customize-controls script as its dependency.

Modifying meta tags after doing ajax call in plugin

It took me a while of tinkering with the hooks, but in the end, I fixed it by loading the post earlier. Instead of loop_start: $this->loader->add_action(‘loop_start’, $plugin_public, ‘mp_display_post’); I used get_header: $this->loader->add_action(‘get_header’, $plugin_public, ‘mp_display_post’); This worked properly because now the post information is loaded before wp_head gets called, and therefore I can use the loaded … Read more

TinyMCE 4.7.11 custom styles using styleselect – what does the ‘attributes’ argument do?

I’m not sure this is even the intended use for the argument Yes, it is. Use the attributes option to add HTML attributes (e.g. class, title, etc.) to the generated or target element (e.g. span). So based on your example: array( ‘title’ => ‘Link Resource’, ‘selector’ => ‘a’, ‘classes’ => ‘smart-link-external smart-link-resource’, ‘wrapper’ => false, … Read more

Auto save permalink setting page with the plugin activation

You should use flush_rewrite_rules function for that. You have to remember, that this is expensive task, so you should not do it every time the site loads (many tutorials are making such mistake). Of course you can use it in your plugin activation hook: register_activation_hook( __FILE__, ‘myplugin_flush_rewrites’ ); function myplugin_flush_rewrites() { // call your rewrite … Read more