• One site I have a database error on:

    WordPress database error Unknown column ‘type’ in ‘WHERE’ for query SELECT COUNT(*) FROM wp_statistics_pages WHERE type = ” made by require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘plugins_loaded’), WP_Hook->do_action, WP_Hook->apply_filters, WP_Statistics->plugin_setup, WP_Statistics->includes, require_once(‘/plugins/wp-statistics/includes/class-wp-statistics-install.php’), WP_STATISTICS\Install->__construct, WP_STATISTICS\Install::init_page_type_updater, WP_STATISTICS\Install::is_require_update_page, WP_STATISTICS\Install::get_require_number_update

    Indeed the ‘type’ column is missing, I can see in the database table on this site compared to working site… seems like there is part of the install/upgrade script that might not have run?

    I can’t seem to find that install/optimize db button within wp-statistics settings we used to have?

Viewing 3 replies – 1 through 3 (of 3 total)
  • Plugin Support Mehmet

    (@gandomi)

    Hi @programmin,

    Thanks for your message.

    The error is due to the missing type column in the wp_statistics_pages table.

    Before making any changes, please make sure to back up your database.

    Then, try running this SQL command:

    ALTER TABLE wp_statistics_pages ADD COLUMN type varchar(180) NOT NULL;

    The database optimization tools are now under:
    Statistics > Optimization > Data Cleanup
    This section handles tasks like removing old records, visitor data, user agents, and more.

    To help us understand why this happened, we’d appreciate if you could share:

    • Your Site Health Info
    • When the issue started
    • Whether the site was migrated, cloned, or updated recently

    Looking forward to your reply.

    Best,
    Mehmet

    Thread Starter programmin

    (@programmin)

    Thanks, column is there and empty, yet not causing all the errors.

    The Data cleanup area doesn’t have the previous optimize/install option button? And it seems part of that install to set the database hadn’t run on this one.

    Hi @programmin,

    Since the column was recently created, it’s expected that the “type” data is empty. New records will have this data going forward.

    As Mehmet mentioned, the optimization tools are now located under Statistics > Optimization > Data Cleanup. We’re continuously improving these options, so some may be added or removed over time.

    Could you please share what specific optimization options you’re looking for?

    Best regards,
    Matthew

Viewing 3 replies – 1 through 3 (of 3 total)

The topic ‘Missing column, latest wp-statistics’ is closed to new replies.