Recall & Review
beginner
What is the purpose of plugin database tables in WordPress?
Plugin database tables store data specific to a plugin's functionality, separate from WordPress core tables, allowing plugins to manage their own data efficiently.
Click to reveal answer
intermediate
How do WordPress plugins create custom database tables?
Plugins create custom tables using the
dbDelta() function inside activation hooks, which safely creates or updates tables based on SQL statements.Click to reveal answer
beginner
Why should plugin database tables use the WordPress table prefix?
Using the WordPress table prefix (usually
$wpdb->prefix) prevents naming conflicts and ensures compatibility with multisite installations.Click to reveal answer
intermediate
What is the role of the
$wpdb object when working with plugin tables?$wpdb is WordPress's database access object. It helps safely query, insert, update, and delete data in plugin tables using prepared statements to avoid SQL injection.Click to reveal answer
beginner
When should a plugin remove its custom database tables?
A plugin should remove its custom tables only if the user chooses to delete plugin data during uninstall, to avoid accidental data loss.
Click to reveal answer
Which WordPress function is commonly used to create or update plugin database tables?
✗ Incorrect
dbDelta() safely creates or updates tables based on SQL statements.Why should plugin tables use the WordPress table prefix?
✗ Incorrect
The prefix prevents naming conflicts and supports multisite setups.
Which object is used to interact with the database in WordPress plugins?
✗ Incorrect
$wpdb is the WordPress database access object.When should a plugin delete its custom database tables?
✗ Incorrect
Deleting tables only on uninstall with user consent avoids accidental data loss.
What is the main risk if plugin database tables do not use prepared statements?
✗ Incorrect
Prepared statements protect against SQL injection attacks.
Explain how a WordPress plugin should create and manage its custom database tables.
Think about the plugin lifecycle and WordPress database tools.
You got /5 concepts.
Describe best practices for deleting plugin database tables when uninstalling a plugin.
Consider user control and data safety.
You got /5 concepts.