WordPress database error: [Table ‘wordpress.wp_slp_extendo_meta’ doesn’t exist]
select count(*) from wp_slp_extendo_meta

This is from a fresh WPSLP install.

  • Go To Plugins
  • Activate SLP
  • Click on Dashboard

Research

Will not reproduce if the Power and/or SLP plugin are deactivated and re-activated.

Reproduces if only SLP is activated.

\SLP_Data::is_Extended() Try/Catch Failure

The error is coming from the get_var() call in wpdb , the try/catch is not working here.


	/**
	 * Returns true if there are ANY extended data fields in the meta table.
	 */
	public function is_Extended() {
		if ( is_null( $this->options['data_is_extended'] ) ) {
			try {
				$extended_meta_count               = $this->db->get_var( "select count(*) from {$this->extension->metatable['name']}" );
				$this->options['data_is_extended'] = ( $extended_meta_count > 0 );
			} catch ( Exception $e ) {
				$this->options['data_is_extended'] = false;
			}
		}

		return $this->options['data_is_extended'];
	}

Patch

SLP commit 70bd1ac57a7799cd9fb831f6f92bf2724dfd771e

Used “vibe coding” (AI assist) to generate a patch:

 	/**
-	 * Returns true if there are ANY extended data fields in the meta table.
+	 * Determine if the data is extended based on whether the associated table has rows.
+	 *
+	 * @return bool True if the table has rows and data is extended, false otherwise.
 	 */
 	public function is_Extended() {
 		if ( is_null( $this->options['data_is_extended'] ) ) {
-			try {
-				$extended_meta_count               = $this->db->get_var( "select count(*) from {$this->extension->metatable['name']}" );
-				$this->options['data_is_extended'] = ( $extended_meta_count > 0 );
-			} catch ( Exception $e ) {
-				$this->options['data_is_extended'] = false;
-			}
+			$this->options['data_is_extended'] = $this->table_has_rows( $this->extension->metatable['name'] );
 		}
 
 		return $this->options['data_is_extended'];
	/**
	 * Check if a table exists and has rows
	 *
	 * @param string $table_name The table name to check (including prefix)
	 *
	 * @return bool True if table exists and has rows, false otherwise
	 */
	private function table_has_rows( $table_name ) {
		global $wpdb;

		// First check if table exists
		$table_exists = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT COUNT(1) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = %s",
				$table_name
			)
		);

		if ( ! $table_exists ) {
			return false;
		}

		// If table exists, check for rows safely
		try {
			$row_count = $wpdb->get_var( "SELECT EXISTS (SELECT 1 FROM {$wpdb->esc_like($table_name)} LIMIT 1)" );

			return ! empty( $row_count );
		} catch ( Exception $e ) {
			return false;
		}
	}