Support » Plugin: Smush Image Optimization, Compression, and Lazy Load » Create tables during plugin activation

  • Resolved candrews

    (@candrews)


    According to https://codex.wordpress.org/Creating_Tables_with_Plugins plugins should create tables during plugin activation.

    However, this plugin doesn’t do that.

    In lib/class-wp-smush-dir.php, create_table() creates the table. This function starts with:

    // Run the query only on directory smush page.
    if ( ! isset( $_GET['page'] ) || 'smush' !== $_GET['page'] ) {
            return null;
    }

    I suggest that, in order to comply with WordPress best practices:
    1. A call to register_activation_hook be added which calls create_table()
    2. The if condition checking the page be removed from create_table()
    3. All other calls to create_table be removed

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Create tables during plugin activation’ is closed to new replies.