How to get row value from wpdb

As @nmr says, $row is an array of objects. You’ll need to foreach these – and do the check in the foreach like this: foreach ($row as $item) { if($item->notification == ‘1’) { echo ‘Yes’; } } And there’s no “notification” column as far as I know. Also, can you explain what you’re trying to … Read more

WPDB SQL query SELECT from category

If you are find products by specified category. Please find below code : $results = $wpdb->get_col( ” SELECT p.ID FROM {$wpdb->prefix}posts as p INNER JOIN {$wpdb->prefix}postmeta as pm ON p.ID = pm.post_id LEFT JOIN {$wpdb->prefix}term_relationships ON ({$wpdb->prefix}posts.ID = {$wpdb->prefix}term_relationships.object_id) WHERE p.post_type LIKE ‘product’ AND p.post_status LIKE ‘publish’ AND pm.meta_key LIKE ‘_stock_status’ AND pm.meta_value LIKE ‘instock’ … Read more

I want to get term by term_name without taxonomy

The get_term() function does not accept a string or array; it only accepts an ID, a stdClass object or a WP_Term object. So I think you’re headed in the right direction using $wpdb. But the SQL query can’t accept a PHP array. So try this: $term_names = [‘red’,’blue’]; $term_names_str = implode(‘, ‘, $term_names); $term_datas = … Read more

$wpbd->insert() does not insert user data

user_register action allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. So you wish to insert record for user when user register you can modify your code like follows: add_action( ‘user_register’, ‘nuevoPostulante’, 10, 1 ); function nuevoPostulante( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)