Custom Field Multiple Clauses

First, the sample WHERE clause you provide doesn’t make sense. That is not how to write a query that will return “between a range of startDate and endDate”. Secondly… I am basically looking for posts which are between a range of startDate and endDate and should show further posts also. It is not clear what … Read more

Slow meta query with multi meta keys

The problem here is that post meta wasn’t designed for these kinds of searches, that’s why the taxonomy tables exist, else categories and tags would be stored as post meta Post meta is optimised for fetching data when you already know the post ID Taxonomies are optimised for finding posts when you already know the … Read more

How can I sort get_users() by any value (last_name, user defined fields and more)

get_users() does not allow you to directly sort by whatever you like, but there are ways around it. The Codex for get_users() says: orderby – Sort by ‘ID’, ‘login’, ‘nicename’, ’email’, ‘url’, ‘registered’, ‘display_name’, ‘post_count’, ‘include’, or ‘meta_value’ (query must also contain a ‘meta_key’ – see WP_User_Query). meta_value is a very powerful way to go … Read more

Problem with adding exta field in metabox in custom post type

You didn’t retrieve your 2 values in the save_post action. You need to get $_POST[’freebie-demo’] (it’s ok for it) and $_POST[‘freebie-downurl’] If you want an array post meta value based, you can do something like that : // Sanitize user input. $de_url[‘name’] = sanitize_text_field( $_POST[‘freebie-demo’] ); $de_url[‘url’] = esc_url($_POST[‘freebie-downurl’]); // Update the meta field in … Read more

Only display custom field if it there is a value inside

use empty function to check if the return value is empty or not: <?php if ( function_exists(‘get_custom_field_value’) ): $custom_field_value = get_custom_field_value(‘Essential info 5′, true); if(!empty($custom_field_value)): ?> <li><span> <?php echo $custom_field_value; ?> </span></li> <?php endif; endif; ?> also check if the function ‘get_custom_field_value’ is returning with echo statement, you may need to change that to just … Read more

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