cURL running slow in WordPress

The timeout issue, in my case, was caused by the remote server not sending back any response. I had to fix configuration on the remote server to send back a response. That has resolved the issue.

Adding extra cost to woocommerce flat rate based on shipping zone

To adjust the WooCommerce code so it adds an extra specific amount based on the shipping zone, you can modify the existing function to include shipping zone-based costs. Here’s a streamlined version of the code: add_filter( ‘woocommerce_package_rates’, ‘add_cost_based_on_zone_and_quantity’, 10, 2 ); function add_cost_based_on_zone_and_quantity( $rates, $package ) { $shipping_class = “very-light-weight”; // Define the shipping class … Read more

WordPress CPT & Custom Taxonomy with the SAME Permalink Structure

Permalink Structure Function This function constructs the permalink for the ‘guide’ post type, including all hierarchical terms, with added spaces for style consistency: function xx_guide_permalink_structure($post_link, $post) { if ( ‘guide’ === $post->post_type && $terms = get_the_terms( $post->ID, ‘guide-category’ ) ) { usort( $terms, function( $a, $b ) { return $a->parent – $b->parent; } ); // … Read more

fetch from an external api call and display results in page

Guide to displaying data from an external API in WordPress using a shortcode: 1. Create a Shortcode in functions.php Create a shortcode in your functions.php file that outputs a container for the results and includes a JavaScript file: function fetch_external_api_data() { wp_enqueue_script(‘custom-api-fetch-script’); return ‘<div id=”apiResults”></div>’; } add_shortcode(‘external_api_data’, ‘fetch_external_api_data’); 2. Enqueue and Write JavaScript Create api-fetch.js … Read more

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