I am having a problem with fetching product data in the Gutenberg block editor
I am having a problem with fetching product data in the Gutenberg block editor
I am having a problem with fetching product data in the Gutenberg block editor
After review, I would expect your code to work properly: to only save the creating author’s nickname, and not override it later. Here’s some code to try with slight improvements and redundancies (tested): function data_nickname( $post_id, $post, $update ) { // If the post is being updated, bail. if ( $update ) { return; } … Read more
That script uses lots of WordPress packages, and WP Scripts makes sure it doesn’t put those in the built JS to stop it getting huge. Part of that is it creates a PHP file that just returns an array of all the things. That code however has put [] in the dependencies spot, and tells … Read more
Ok, I found the answer myself thanks to Can you filter posts by meta key with the getEntitityRecords selector? Despite my first understanding the >>>query<<< parameters for list posts given in the Reference do >>>not<<< contain the meta. I followed the article and created a query filter for the CPT, i.e. function mycustomposttype_meta_query_filter() { add_filter( … Read more
I think you’re close. In my code I’ve assumed that the desired customer_email meta looks like this: array( 0 => ‘[email protected]’, 1 => ‘[email protected]’, 2 => ‘[email protected]’, ); What you need to do is add the new email address to the array of existing email addresses, then save the updated array back to the meta … Read more
Your syntax is correct, if the query isn’t coming up with anything it’d be worth checking for typos. Is that double D in installDDate deliberate? The reason it uses nested arrays is to allow for more than one meta key/value pair in the query, which can be combined with different relations. Each pair would have … Read more
You can set the keys of the array to be user-friendly, but more appropriate would be to define the options array in a function, and then use that function in both the backend and frontend (untested): Array function product_condition_array() { return array( ‘new’ => __( ‘New’, ‘woocommerce’ ), ‘like_new’ => __( ‘New other (see description) … Read more
Sure, we can modify meta tags in WordPress using actions and filters. The <title> tag is pretty easy, WP already has a filter called document_title_parts that allows you to manipulate the title before being outputted to the page. Here’s a simplified example of using it : add_filter( ‘document_title_parts’, ‘filter_document_title_parts’, 10, 1 ); function filter_document_title_parts( $title_parts … Read more
Extend file format support for post thumbnails
How to get posts that have certain meta key value and order based on another meta key’s value