Support » Fixing WordPress » How do I remove all values by brand?

  • How do I remove all values by brand?

    $allpostids = ‘All Postids’;

    $allmetakeys = ‘All Metakeys With Dots And Numbers’;

    $allnumberswithcomma = ‘All numbers with comma’ ‘ Markerfordeletion’;

    Delete_post_meta ($allpostids, $allmetakeys, $allnumberswithcomma);

    How to remove all values with the Mark Markerfordeletion

    • This topic was modified 3 months, 1 week ago by  manoodin.
    • This topic was modified 3 months, 1 week ago by  manoodin.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I don’t follow how your criteria would match a brand, but maybe it doesn’t matter. The general answer is you can use wpdb::delete() to remove any table rows matching any arbitrary criteria. You can ignore post ID and meta key columns if you want and just focus on meta values. You can match very elaborate constructs using the REGEXP_LIKE() MySQL function.

    I strongly suggest you first test your criteria in a limited scope in phpMyAdmin using the LIMIT clause before turning it loose on the entire table. Before doing anything, make a backup of your DB. It’s all to easy to inadvertently corrupt your DB using this function. It is extremely powerful and thus extremely dangerous.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.