Skip to content

Tag: wordpress

Programmatically creating new order in Woocommerce

I am having the hardest time programmatically creating an order in WooCommerce. I am using the code below and is DOES create an order BUT I cannot get customer information OR product line items added to the order. The new order that is create is simply as Guest with no items, user information, etc. The issue …

Get user role by ID WordPress

I need to somehow check someone’s role with only their id. I have found the current_user_can() check. But this only works for people that are logged in. How would I check for this if that user isn’t the current user? I am using a phone order system but that uses the admin/specific account to order…

set urls with parameter to noindex in wordpress?

I’m looking for a solution to set all URLs which uses the parameter ‘?’ to noindex. I look for a php solution which I could use in the header.php in WordPress or in the .htaccess. I tryed this: This solution did not work and URLs with the parameter ‘?’ didn’t get a noindex …

Calling a PHP function on button click?

I have a html button which has an onclick method. The function which is ran onclick has a php function in but is called in JS, like below. The page this code is on is a wordpress admin page. When the page loads, the php function is ran anyway instead of waiting for the button click event. Is there a

WordPress get attachment image caption

I tried to get attachment meta caption value as mentioned here, but couldn`t get any output. Other meta arrays like [created_timestamp] or [iso] gave their values. This issue happens to both and [title]. Any help is much appreciated. Answer The caption and title you are looking to get from wp_get_attachment_m…

WordPress Woocommerce Redirect Argument

When I enable my site automatically show argument ?v= like this How can I fix this? Answer String to all urls ?v=XXXXXXXXXXXX. That URL is coming from standard base address setting in Woocommerce. When you choose geolocation with caching support for page, it will add that ?v=xxxx string because it’s cap…