I have created a trigger on the posts table. but I want this trigger to be executed if the user connected to the database is x user.
I have tried to connect to the WordPress database with x user. it's working but the object wpdb contains null values in the posts,users, prefix and the other settings I were got from the default database connection with the WordPress database user.
code I used to connect with x user:
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
part of the $wpdb
object :
public 'comments' => null
public 'commentmeta' => null
public 'links' => null
public 'options' => null
public 'postmeta' => null
public 'posts' => null
public 'terms' => null
public 'term_relationships' => null
public 'term_taxonomy' => null
public 'termmeta' => null
public 'usermeta' => null
public 'users' => null
public 'blogs' => null
public 'blog_versions' => null
public 'registration_log' => null
public 'signups' => null
public 'site' => null
public 'sitecategories' => null
public 'sitemeta' => null
public 'field_types' =>
So how to deal with this issue?