Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.35 KB | None | 0 0
  1. <?php  
  2. include_once("wp-config.php");
  3. include_once("wp-includes/wp-db.php");
  4.  
  5. $sql = "SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.ID FROM wp_posts LEFT JOIN wp_postmeta AS sq1 ON ( wp_posts.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' ) LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id LEFT JOIN wp_term_relationships AS trel ON (wp_posts.ID = trel.object_id) LEFT JOIN wp_term_taxonomy AS ttax ON (( ttax.taxonomy = 'yst_prominent_words' ) AND trel.term_taxonomy_id = ttax.term_taxonomy_id) LEFT JOIN wp_terms AS tter ON (ttax.term_id = tter.term_id) WHERE 1=1 AND wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'inherit' OR wp_posts.post_status = 'private') AND ( (wp_posts.ID LIKE '%shutterstock%') OR (wp_posts.post_title LIKE '%shutterstock%') OR (wp_posts.guid LIKE '%shutterstock%') OR (wp_posts.post_content LIKE '%shutterstock%') OR (wp_posts.post_excerpt LIKE '%shutterstock%') OR (wp_postmeta.meta_key = '_wp_attachment_image_alt' AND wp_postmeta.meta_value LIKE '%shutterstock%') OR (wp_postmeta.meta_key = '_wp_attached_file' AND wp_postmeta.meta_value LIKE '%shutterstock%') OR (tter.slug LIKE '%shutterstock%') OR (ttax.description LIKE '%shutterstock%') OR (tter.name LIKE '%shutterstock%') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 20";
  6.  
  7. $results = $wpdb->get_results($sql);
  8.  
  9. var_dump($results);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement