Add Product Permalink in woocommerce admin order page

There’s no permalink property of a product. Permalinks are not stored in the database, because they’re generated based on a number of external factors. Therefore you need to use a function to retrieve the permalink. In WooCommerce the best way to do this is with: function fpd_custom_order_item_values($_product) { $url = $_product->get_permalink(); echo ‘<p>’ . esc_url( … Read more

Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint

I figured out it could be an Authorization problem, then I looked the WooCommerce webhook functions and fount where the delivery is executed: /wp-content/plugins/woocommerce/includes/class-wc-webhook.php I hard coded my Authorization header after line # 303 in the deliver() function: ‘headers’ => array( ‘Content-Type’ => ‘application/json’, ‘Authorization’ => ‘Basic bmNkaWgdrGFsOiNIb25kdXJhczIwMThTUFMh’, ), Now I need to calculate the … Read more

custom-header not working

Got it working. I had to call the function in my page where I want it to work, the method of doing so is here: https://developer.wordpress.org/themes/functionality/custom-headers/#displaying-custom-header (link provided by Jacob Peattie) and it needs to be within the tags rather than simply a div with an id of site-header.

Collect all events in one year

OK, your events are already sorted by date, so all you have to do is to ignore header, previous event had the same year. Let’s also try to avoid all that spaghetti code, you’ve posted in question: <?php $previous_year = false; while ( $myrow = mysqli_fetch_array($result) ) : $event_datetime = strtotime($myrow[‘event_date’]); ?> <?php if ( … Read more

How does one make a URL return dynamic JSON with custom Content Type?

I asked this on stack overflow as well. You can find that answer here: https://stackoverflow.com/a/56801044/343292 I’ll copy and paste the answer below incase the link ever breaks. It worked for me. I used the dynamic way. ANSWER FROM @Sally CJ Note: I’m assuming WordPress is installed in the root folder. So if you want http://example.com/apple-app-site-association … Read more

Can’t access 3rd party API, code works on local server but not on wordpress

Can you drop this in and let us know what $content looks like? <?php $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, “A WORKING API”); $content = curl_exec($c); curl_close($c); echo ‘<pre>’; print_r($content); echo ‘</pre>’; I am curious if this is a WordPress issue or just a CORS issue with the call being made from a … Read more