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

How to force a query conditional?

Did you check what part of is_front_page() is causing it to return false? I could reproduce the problem by following the setup from the trac ticket. In my case inside this function the call to is_page() was returning false. I guess this is due to using $wp_query->set() for page_id and is_page is only causing the … Read more

How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?

is_plugin_active() is rather fragile: it will break when either the plugin author renames the main file or when the user renames the plugin’s directory or main file. It’s better to check if a certain public function exists. To avoid having to make that check each time you need some of the plugin’s functionality, you could … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)