Saving multiple Metabox contents

Aha! Stupid error. I didn’t give it a proper METAKEY! This seems to have fixed things: /* Save the meta box’s post metadata. */ function save_metabox_exhibition( $post_id, $post ) { $fields = 0; if($_POST) { $metaboxes[0][‘nonce’] = $_POST[‘exhibition_finish_date_nonce’]; $metaboxes[0][‘data’] = $_POST[‘gc_finish_date’]; $metaboxes[0][‘meta’] = ‘gc_finish_date’; $metaboxes[1][‘nonce’] = $_POST[‘exhibition_start_date_nonce’]; $metaboxes[1][‘data’] = $_POST[‘gc_start_date’]; $metaboxes[1][‘meta’] = ‘gc_start_date’; $metaboxes[2][‘nonce’] = … Read more

Theme Demo in live Site

Drop this inside a .php file in in wp-content/mu-plugins: add_filter(‘template’, ‘check_for_theme_preview’); add_filter(‘stylesheet’, ‘check_for_theme_preview’); // if you want to display the theme selector // (this is wrong, you need a custom action in each of your themes, after <body>) add_action(‘wp_head’, ‘display_template_selector’); // checks for the “theme-preview” argument, and changes the template function check_for_theme_preview($template){ session_start(); if(isset($_SESSION[‘template’])) $template … Read more

Custom Widget outputs the input but doesn’t save anything inside the textarea

Your primary issue isn’t with saving the data but displaying in the form if it has been saved. I rewrote the offending function: function form($instance) { $title = strip_tags( $instance[‘title’] ); $info = esc_textarea( $instance[‘info’] ); // var_dump($instance); // debug ?> <p> <label for=”<?php echo $this->get_field_id(‘title’); ?>”><?php _e(‘Title:’); ?></label> <input class=”widefat” id=”<?php echo $this->get_field_id(‘title’); ?>” … Read more

Exclude Custom Post Type & Pages From Auto-Tag Function

In save_post action you can access to the objet of the saved post and check the post type before tagging it: add_action( ‘save_post’, ‘add_authors_name’, 10, 2 ); function add_authors_name( $post_id, $post ) { // The post types you want be tagged to $valid_post_types array $valid_post_types = array( ‘post’, ‘community’ ); if( in_array( $post->post_type, $valid_post_types) ) … Read more

How to hook into the quick edit action?

There are two flaws in the code that I can see. The first one is a bug in this code if($post->post_type != ‘product’) If no post exists, you get the following error Notice: Trying to get property of non-object… This can be fixed by first checking if a post isset if(isset($post) && $post->post_type != ‘product’) … Read more

Automatically assign a custom post to a custom taxonomy based on custom field value

I’m sure this not best answer, however you may try like this add_action(‘save_post’, ‘add_my_taxonomy’); function add_my_taxonomy($post_ID) { $area = array( ‘ny’ => ‘New York’, ‘la’ => ‘Los Angeles’ ); $zip = array( ‘ny’ => ‘10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010, 10011, 10012, 10013, 10014, 10015, 10016, 10017, 10018, 10019, 10020, 10021, … Read more