How can I connect to a second database and still be able to use wp functions like get_post_types()?
How can I connect to a second database and still be able to use wp functions like get_post_types()?
How can I connect to a second database and still be able to use wp functions like get_post_types()?
DB prefix not updating
How do I get database rows from a custom table using wpdb?
Limiting posts based on nested meta_query
Use the below code it may help you and sure that your sql query is correct then it will be work properly. function wpb_demo_shortcode() { global $wpdb; $results = $wpdb->get_results( $wpdb->prepare(“SELECT DISTINCT o.order_id, o.`order_item_name`, om.`meta_value` as ‘bcs’, (select pm.`meta_value` from `wp_postmeta` as pm WHERE o.order_item_id = om.order_item_id AND pm.`post_id` = o.order_id AND pm.`meta_key` = ‘2-certificate’) … Read more
Alright, You did not mention if that data will be stored upon submission from front end or you want to manually put that in. But lets see the way I would handle form submissions and store email addresses. I would use contact form 7 along with its addon Flamingo. It will let you store all … Read more
wpdb Insert unknown post data dynamic foreach loop
This is written on the assumption that this data will only be retrieved when the user ID is known, and always in full for that user. If any kind of filtering is needed, if you need to filter users themselves by this data, then this answer will no longer apply. One Row per User This … Read more
I managed to solve via CURL requests via PHP, the code is as follows. functions.php of site A: add_action( ‘woocommerce_order_status_completed’, ‘change_role_on_purchase’ ); function change_role_on_purchase( $order_id ) { $order = new WC_Order( $order_id ); $items = $order->get_items(); foreach ( $items as $item_id => $item ) { $product_id = $item->get_variation_id() ? $item->get_variation_id() : $item->get_product_id(); if ( $product_id … Read more
I managed to solve after several attempts using the following code: // Insert the role $role = array(‘gold_role’ => 1); $serialized_role = serialize($role); $DB_MEMBERSHIP->insert(‘wpvm_usermeta’, array(‘user_id’ => $user_id, ‘meta_key’ => ‘wpvm_capabilities’, ‘meta_value’ => $serialized_role)); It works very well and doesn’t slow down the shopping experience.