Delete post based on a custom field?

You don’t have a ON for your LEFT JOIN, I guess the WHERE statement you use has to be the ON statement. You should use this query instead: $querystr = ” DELETE FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE $wpdb->postmeta.meta_key = ‘randomID’ AND $wpdb->postmeta.meta_value=”$randomID””; Reference here: http://dev.mysql.com/doc/refman/5.0/en/join.html

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

WP_Query on custom post type not displaying, multiple loops & get_template_part

I think you forgot to check if $the_query have posts. <?php $args = array( ‘post_type’ => ‘testimonials’, ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’ ); $the_query = new WP_Query( $args ); ?> <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div class=”testimonial push_2 grid_10 clearfix”> <blockquote>&ldquo;<?php the_field( ‘testimonial’ ); ?>&rdquo;</blockquote> <cite>&mdash;<?php … Read more

Store JSON in a custom field

Yes! Yes you can! You can use this code to retrieve a stored option: $value = get_post_meta($post->ID,’customfieldname’,true); // where true means only return 1 custom field by this name You can use this code to save a stored option: update_post_meta($post->ID,’customfieldname’,$valuetobestored); The above code will need to be inside the post loop, though you can supply … Read more

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