Why $wpdb works on localhost but it is not working on server

208 views Asked by At

I am building a plugin in WordPress and $wpdb queries works on local, but when I upload the code to the server it doesn't work.

Here is the code that I'm using:

<?php 

global $wpdb;

$resultado = $wpdb->get_results(
    $wpdb->prepare(
        "SELECT meta_value FROM wp_postmeta WHERE meta_key='keywords'",
        OBJECT
    )
);

$keywords = implode(',', array_column($resultado, "meta_value"));

?>
0

There are 0 answers