How-To: Get meta data from the users last order in woocommerce

First thing is to grab the last order ID, you can do it with a simple WP_Query $args = array(‘post_type’=>’product’, ‘posts_per_page’=>1, ‘orderby’=>’ID’, ‘orderby’=>’DESC’); $query= WP_Query($args); As this will only give only one result, you don’t need to loop the result, $order_id= $query->posts[0]->ID; Now, you can reach the order data, $order = WC_Order($order_id); You can use … Read more

Limit user access to installing/configuring a plugin?

WP doesn’t have a built-in way to restrict permissions this granularly. You can either install plugins, or not. For settings, it depends on where the plugin surfaces its settings. For example, if the settings are under the “Settings” menu, then by default only users with role “administrator” will be able to access and adjust them. … Read more

Anyone Can Register

It simply allows the general public to create a new WordPress user. Whether or not they can see other user’s user information depends on the default role assigned to new users and any capabilities assigned. Unless you change the default role setting, new users will be assigned the Subscriber role which only has the read … Read more

i need to let a user to add a role from a frontend form

I think each user can only have one role. However this is how its possible to change role, if for some reason that I dont know the user can have more than one role, remove the remove role line. you can check the available roles here. $current_user = wp_get_current_user(); // Remove role $current_user->remove_role( ‘subscriber’ ); … Read more

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