Support » Plugin: Mass set Categories » Revise your DB query

  • Thanks for this plugin. It’s a huge timesaver.

    However, as another user pointed out, it didn’t pre-populate with my existing categories.

    I dug through the code and realized that you had your DB prefixes hard coded (and my site has custom prefixes.)

    Here’s the fix, in case you want to update your code.

    $q = "SELECT    $wpdb->terms.'name', $wpdb->terms.'term_id' FROM     $wpdb->term_relationships
    	INNER JOIN  $wpdb->term_taxonomy ON ($wpdb->term_relationships.'term_taxonomy_id' = $wpdb->term_taxonomy.'term_taxonomy_id')
    	INNER JOIN  $wpdb->terms         ON ($wpdb->term_taxonomy.'term_id' = $wpdb->terms.'term_id')
    	INNER JOIN  $wpdb->posts         ON ($wpdb->term_relationships.'object_id' = $wpdb->posts.'ID')
    	WHERE ($wpdb->posts.'ID' = $postid)";
    • This topic was modified 1 year, 8 months ago by thingevery.
    • This topic was modified 1 year, 8 months ago by thingevery.
    • This topic was modified 1 year, 8 months ago by thingevery.
    • This topic was modified 1 year, 8 months ago by thingevery. Reason: formatting
    • This topic was modified 1 year, 8 months ago by thingevery. Reason: code formatting again
  • The topic ‘Revise your DB query’ is closed to new replies.