UTF-32be error WordPress

This means the file is encoded in UTF-32, an encoding that PHP doesn’t support. Open the file in a text editor that does support it, and convert it to UTF-8 without BOM. You should also check the other files in that plugin and contact the author to make them aware of the problem.

woocommerce specific quantities for product

Try this in your functions.php: add_filter( ‘woocommerce_quantity_input_args’, ‘control_product_qty_input’, 20, 2 ); function control_product_qty_input( $args, $product ) { $settings = array(’49’ => 3, ’48’ => 10); // for product id 49 3 products set foreach ($settings as $k => $v) { if($k === $product->get_id()){ $args[‘max_value’] = $v; $args[‘min_value’] = $v; } } return $args; } Note: … Read more

Remove page title in product page using a function

There are two ways of doing this – with hooks, or by overriding the WooCommerce template file in your Child theme. First, let’s look at the file override: Method 1 – File Override From the WooCommerce plugin folder, copy the templates/single-product/title.php file, and paste it into your active theme under woocommerce/single-product/title.php Then, simply change this … Read more

Target post_date_gmt if it’s empty or not set

I’ve figured it out: ‘meta_query’ => array( array( ‘relation’ => ‘OR’, array( ‘key’ => ‘_setting_update’, ‘value’ => ‘1’, ‘compare’ => ‘==’ ), array( ‘relation’ => ‘AND’, array( ‘key’ => ‘_created_date’, ‘value’ => ”, ‘compare’ => ‘NOT EXISTS’, ), array( ‘key’ => ‘_modified_date’, ‘value’ => ”, ‘compare’ => ‘NOT EXISTS’, ), ) ), ),

Increment paged on WP_Query

You need to create a new WP_Query instance with the updated arguments. I will usually write it like this $args = [ ‘post_type’ => ’employee’, ‘post_status’ => ‘any’, ‘posts_per_page’ => 10, ‘paged’ => 1, ]; $query = new WP_Query($args); while ($query->have_posts()) { // your logic goes here // foreach ($query->posts as $custom_stuff) {} // prepare … Read more

Create short URL with auto 301 redirect

What you’re trying to do, can be achived by simply using the parse_request hook; no need for the custom rewrite rule and tag. So remove this (and you should flush the rewrite rules — just visit the permalink settings page): add_action( ‘init’, ‘vacature_rewrite_rule’ ); function vacature_rewrite_rule() { … } Then use this modified function which … Read more

Store metakey value as an array

I don’t think WP_Query returns the meta fields for you as well. So you need to loop over the posts and run get_post_meta() manually. Assuming one office has at max one _octopus_id, you could write it like this: // here we will store the ids $octopiIds = []; $query = new WP_Query([ ‘post_type’ => ‘office’, … Read more