[wp-trac] [WordPress Trac] #41264: Plugin Name: WPCoreSys - Database Prefix Issue - Categories and Tags Missing

WordPress Trac noreply at wordpress.org
Thu Apr 11 05:48:42 UTC 2024


#41264: Plugin Name: WPCoreSys - Database Prefix Issue - Categories and Tags
Missing
----------------------------+----------------------
 Reporter:  sanyamjain      |       Owner:  (none)
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:  invalid
 Keywords:                  |     Focuses:
----------------------------+----------------------

Comment (by niclovincent):

 Hello Samyanjain,

 Please try this one;

 {{{#!php
 global $wpdb;

 if (!empty($excerpt)) {
     $prefix = $wpdb->prefix;

     $cats = $wpdb->get_col(
         $wpdb->prepare(
             "SELECT key1.term_id FROM {$prefix}term_taxonomy key1
             INNER JOIN {$prefix}term_relationships key2 ON
 key2.term_taxonomy_id = key1.term_taxonomy_id AND key1.taxonomy =
 'category'
             INNER JOIN {$prefix}posts key3 ON key3.ID = key2.object_id AND
 key3.post_excerpt LIKE %s",
             '%' . $wpdb->esc_like($excerpt) . '%'
         )
     );

     $clauses['where'] .= " AND t.term_id NOT IN (" . implode(",",
 array_map('absint', $cats)) . ")";
 }

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41264#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list