What is the correct method for determining ‘is_front_page’ when using filters such as ‘pre_get_posts’ and ‘posts_where’?

Regarding the posts_orderby, posts_where, posts_join and posts_clauses hooks, the current \WP_Query object is available through the second input argument. These are the relevant parts from the \WP_Query class: $orderby = apply_filters_ref_array( ‘posts_orderby’, array( $orderby, &$this ) ); $where = apply_filters_ref_array( ‘posts_where’, array( $where, &$this ) ); $join = apply_filters_ref_array( ‘posts_join’, array( $join, &$this ) ); … Read more

Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress

added_post_meta seems like a good time to hook into a new image. Not only is the default meta already set but the function gives you the $post_id along with $meta_value which holds the attachment metadata. From there you can get all the fields and set the ones you want. add_action(‘added_post_meta’, ‘wpse_20151219_after_post_meta’, 10, 4); function wpse_20151219_after_post_meta($meta_id, … Read more