Tag Info

New answers tagged

1

Well, first of all, you use where post_status = 'publish'. So you wouldnt need to explicitly tell the drafts not to show up by using wp_posts.post_status != 'draft' I think, your SQL says somthing like: Grab all posts which are published and not drafted and attached to term_id 17 OR grab all posts which are attached to term_id 18 OR grab all posts ...


0

Maybe not the most elegant solution $authorPost = get_posts(array('author' => 1));foreach ($catPost as $post) { setup_postdata($post); $ids[] = get_the_ID(); } $idList = implode(",", $ids); //turn the array into a comma delimited list $meta_key = 'post_view'; $allview = $wpdb->get_var($wpdb->prepare(" SELECT ...


0

There are a few ways you could do it- NOT IN, NOT EXISTS, IS NULL. Which method is best depends on your actual query. SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = 'somekey' WHERE $wpdb->postmeta.post_id IS NULL


0

Import the database on the new server. When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display. If you do a search and replace on your entire database to change the URLs, ...



Top 50 recent answers are included