• Resolved edsolman

    (@edsolman)


    Hi, I regularly use wp-optimize on my websites and am currently trying to tidy things up on a customer site. The plugin says it has over 6000 orphaned post metadata records, but I’ve run the following query in the database and it returns 0 records, so I can’t figure out how WP-Optimize is calculating the numbers.

    SELECT pm.* FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL

    Can you tell me the query the plugin uses to determine the orphaned metadata records, as it doesn’t seem right to me. If there are genuinely 6000 orphaned records I’d obviously like to clean them up.

    Thanks,

    Ed Solman

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support vupdraft

    (@vupdraft)

    “SELECT pm.* FROM " . $this->wpdb->postmeta . " pm”.

    ” LEFT JOIN " . $this->wpdb->posts . " wp ON wp.ID = pm.post_id”.

    ” WHERE wp.ID IS NULL”.

    ” ORDER BY pm.meta_id LIMIT %d, %d;”,

    Plugin Contributor Venkat Raj

    (@webulous)

    Hi @edsolman

    Please ignore the previous reply. The query is
    SELECT COUNT(*) FROM ok_postmeta pm LEFT JOIN ok_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;

    Make sure you are querying against the correct database, as you query should also return that number of rows with all columns.

    • This reply was modified 1 year, 1 month ago by Venkat Raj. Reason: additional info
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Orphaned post metadata looks wrong?’ is closed to new replies.