Date, Time, and Timezones

What is the purpose of the timezone setting in the Admin -> Settings section? Since WordPress handles time zone on its own (separately from native PHP functionality) that is where the setting made and result is stored in options. Whenever anything that works with timezones needs to happen, the time zone setting is retrieved and … Read more

How do I search an array stored in a custom-field using WP_Query?

Searching inside a serialized array is difficult and inefficient– ie. slow. The following pure SQL will do it: SELECT * FROM `wp_postmeta` WHERE `meta_key` LIKE ‘daysonair’ AND `meta_value` LIKE ‘%thursday%’ LIMIT 0 , 100 Something like this should get WP_Query to do something similar: $args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ … Read more

Why isn’t my code to save custom fields in quick edit working?

I downloaded and activated the code referenced on GitHub, then added custom post type registration code for movies to match the original example. I noticed that the code on GitHub had a bug where the switch statement in manage_wp_posts_be_qe_bulk_quick_edit_custom_box() checks for release_date, coming_soon, and film_rating instead of release_date_column, coming_soon_column, and film_rating_column, so I fixed those … Read more

Extend WP Customizer to make multiple image selection possible

What I eventually did was extending the WP_Customize_Control class as follows: <?php if (!class_exists(‘WP_Customize_Image_Control’)) { return null; } class Multi_Image_Custom_Control extends WP_Customize_Control { public function enqueue() { wp_enqueue_style(‘multi-image-style’, get_template_directory_uri().’/css/multi-image.css’); wp_enqueue_script(‘multi-image-script’, get_template_directory_uri().’/js/multi-image.js’, array( ‘jquery’ ), rand(), true); } public function render_content() { ?> <label> <span class=”customize-control-title”>Image</span> </label> <div> <ul class=”images”></ul> </div> <div class=”actions”> <a class=”button-secondary upload”>Add</a> … Read more

Add new “Insert Into Post” button with another function

There’s a get_image_send_to_editor() function in wp-admin/includes/media.php that runs this: apply_filters( ‘image_send_to_editor’, $html, $id, $caption, $title, $align, $url, $size, $alt );. Try hooking that filter. Edit: Help with the filter call… Your call to hook the callback would look like this: add_filter(‘image_send_to_editor’, array(&$MyClassReference, ‘filter_iste’), 10, 8); The 10 is the priority, you might need to adjust … Read more