Admin auto-refresh is interfering with Firebug — how to prevent it?
Per comments, an alternative is to use the built-in Firefox debugger instead (Inspect Element (Q)) – it’s very good (now) and is (almost completely) unaffected by the WP heartbeat.
Per comments, an alternative is to use the built-in Firefox debugger instead (Inspect Element (Q)) – it’s very good (now) and is (almost completely) unaffected by the WP heartbeat.
So, to answer my own question. In the functions/backend code I made a mistake with this line: ‘id’ => $prefix . ‘media_embed’, In a repeater field it it doesn’t need the prefix and as that is defined in the parent and so it should be: ‘id’ => ‘media_embed’, And for the front end this line: … Read more
I couldn’t find any WP specific event to hook in to. What you can do is set up an observer with a callback to respond to DOM changes using MutationObserver and check if the your featured image has been added in the callback. There’s no support in IE < 11 though, which may be a … Read more
Do not rely on globals like get_the_ID() or get_post() do. Use the parameters for your callbacks. You get the current post object twice: When you register the metabox, you get the post object as a second parameter. When your output callback is called, you get it as the first parameter. Here is an example showing … Read more
I installed the ‘User Role Editor’ plugin and removed the ‘manage_categories’ capability for the ‘Editor’ which worked. But I would like to remove it for ALL users including admin, superadmin. If removing the ‘manage_categories’ capability from the editor role provides the functionality you want, then you can remove the ‘manage_categories’ capability from all user roles … Read more
After searching a lot over the web I found a solution, so I am answering my own question. I hope it might help others. you can pass in the ids of categories you want to hide as an array, and then paste this in your functions.php file. It will work in the new editor. All … Read more
I’ve got this working finally ($template_file == ‘page-tjenester.php’), so now my meta boxes shows up only when I use this specific page-template! This is the final code if someone is interesting; add_action(‘admin_init’,’my_meta_init’); function my_meta_init() { $post_id = $_GET[‘post’] ? $_GET[‘post’] : $_POST[‘post_ID’] ; $template_file = get_post_meta($post_id,’_wp_page_template’,TRUE); if ($template_file == ‘page-tjenester.php’) { // this will only … Read more
Update The answer is so simple, I couldn’t see it at first. 🙂 Just remove the action during the first function call. This way, your work within the API, and your function is really called just once. No need for static or even global variables or constants. function my_metabox_save() { remove_action( ‘save_post’, ‘my_metabox_save’ ); // … Read more
esc_textarea shouldn’t strip out newlines — It’s just a thin wrapper around htmlspecialchars: http://core.trac.wordpress.org/browser/tags/3.3.2/wp-includes/formatting.php#L2536 <?php function esc_textarea( $text ) { $safe_text = htmlspecialchars( $text, ENT_QUOTES ); return apply_filters( ‘esc_textarea’, $safe_text, $text ); } That said, there are lots of options. What do you want your users to do have the ability to post? esc_html will … Read more
Here’s the metabox code what I’m using which is working fine for me: // Add meta boxes with TinyMCE via wp_editor() function // Define the custom box add_action( ‘add_meta_boxes’, ‘product_details_add’ ); // Do something with the data entered add_action( ‘save_post’, ‘product_details_save’ ); // Adds a box to the main column on the Product post_type edit … Read more