Usage of a direct database call is discouraged

  • Unknown's avatar

    Hello,

    I am simply inserting a row into a table.
    “`
    global $wpdb;

    $table_consent = $wpdb->prefix . ‘gjmji_consent’;

    $wpdb->insert(
    $table_consent,
    array(
    ’email’ => sanitize_email( wp_unslash( $_GET[‘gjmp4wp-email’] ) ),
    ‘language’ => WPMJI_LANGUAGE_CURRENT,
    ),
    );

    My code sniffer (wpcs) is telling me that “Usage of a direct database call is discouraged.” I tried something with prepare a while back but couldn’t figure it out. Is that the way to go?

    How do I do this properly?

    Thanks!
    Pragati

    “`

    WP.com: Unknown
    Jetpack: Unknown
    Correct account: Unknown

  • Hi there,

    What is the URL of the site you are referencing? Is the site hosted with us here at WordPress.com? I am not seeing a site connected to the account you are contacting us from. Let us know and we’ll point you in the right direction for support.

    Thanks!

  • Unknown's avatar

    Hi,

    the site is not hosted here, its on my local.

  • Ok, thanks. We’re not really able to help with requests for sites that aren’t hosted with us on WordPress.com – it sounds like your question would be better for the WordPress.org community forums which are at this address:

    https://wordpress.org/support/forums/

  • The topic ‘Usage of a direct database call is discouraged’ is closed to new replies.