Missing Meta Keys on WooCommerce orders

I have a WPML problem with order language being ignored, and according to WPML it is because there is no meta keys in the metabox on orders. I only see attributes. Especially wpml_languages are missing.

I have a fresh install with the same theme, the same WP version and the same plugins – here I do not have this problem.

I have 3 sites from the same DB copy, one local, one for testing and one live. Everyone has this problem.

Have tried switching to a default theme, disabling all plugins, updating everything, etc. Nothing helps.

Any idea what could be causing this?

Can I indicate (via robots.txt, meta robots or another approach) that one or more queryString parameters should be ignored by crawlers?

I’ve written my own SiteSearch Script in PHP.

The SiteSearch parses two GET parameters from the queryString:

  • search // the search-phrase
  • filters (optional) // indicating which parts of the site to include or ignore

I don’t mind GoogleBot and other crawlers reading the search parameter.

But I would like to advise crawlers to ignore the filters parameter, because a very high number of configurations of that parameter would simply return the same results – and an identical, duplicate page as far as the crawlers are concerned.


As much as I would like to add to my robots.txt file something like:

User-agent: * IgnoreParameter: filters 

this isn’t an option.

And a meta robots directive like:

<meta name="robots" content="ignoreparams[filters]"> 

isn’t an option either.

Is there any creative way I can enable crawling of the page and have crawlers ignore the filters parameter in the queryString?

Or am I stuck with a directive as unrefined as:

<meta name="robots" content="noindex"> 

if I don’t want to risk pages with identical search parameters (but different filters parameters) being crawled?

Shortcode to update user meta

I want to create a button on the front end and when user click, the value "user-meta" change ‘validate’

function func_change_validate() {     if (is_user_logged_in()) {         $  current_user = wp_get_current_user();           $  new_value = 'validate';         $  updated = update_user_meta( $  user_id, 'User_meta_change', $  new_value );                     return 'here i want create bootom to updated ?? <button type="submit">Validate</button>';     } }  add_shortcode('change_validate','func_change_validate'); 

Possibility of adding meta description to harvester engine settings ?

Hello,

i have a new question. 

Is it possible to use the “Aditional header / settings”  optin in the harvester setitngs to also grab meta description/ or meta title  when harvesting urls?

And can i display it (the description) in the main window?

Why –  in my experience it is MUCH easier to understand if a site is or is not relevant from URL AND meta description than from just url alone.
so, its way faster to filter out bad results.

thanks.

Use the backbone.js client to save custom post type meta

So I have this small piece of code that renders an array of IDs:

const selected = this.$  data.list.selected; function get_ids(input, field) {     const output = [];     for (let i=0; i < input.length ; ++i)         output.push(input[i][field]);     return output; } const result = get_ids(selected, "id"); 

Now inside my JS, I want to be able to use the backbone.js API that WordPress provides to save it to my employee custom post type as a post meta.

So let’s say that my result output is [343, 3532] – I want to be able to save that array as a "apps" post meta under employees.

I know examples showed that it would be something like const test = new wp.api.models.Employee().fetch and then save, but it sounds super confusing since I don’t have a specific post, and would just like to save the post meta.

Based on these examples, does anyone know how I could do that? https://developer.wordpress.org/rest-api/using-the-rest-api/backbone-javascript-client/#model-examples

meta query regexp only work with first two characters

I have a meta query to return data based on the input value. Here I get value like this Tm-university-brazil,

now I replace the dash with space so it becomes Tm university brazil, but the search does not work, it only works if put ‘Tm’ in search it does not work when ‘Tm university brazil’.

if (isset($  uni_name)  && !empty($  uni_name)  ) {  $  uni_name = str_replace('-'," ",$  uni_name);       $  meta[] = array(             'key'     => 'uniname',             'value'   => $  uni_name,             'compare' => 'REGEXP',                  );  } 

Display Custom Fields Meta Box on Category, Tags and CPT

I want to Add Custom Field on All Tags, Category and Custom Post Type (Taxonomy) but with below code get custom field option only on All Category. How to get on All Tags, Categories and CPT Taxonomy as well?

function wecode_category_fields($  taxonomies) {          if (current_filter() == 'category_edit_form_fields') {               $  Pincode = get_term_meta( $  taxonomies->term_id, 'Pincode', true );               ?>                  <tr class="form-field">         <th valign="top" scope="row"><label for="Pincode"><?php _e('Pincode'); ?></label></th>            <td>               <input type="text" size="40" value="<?php echo esc_attr( $  Pincode ) ? esc_attr( $  Pincode ) : ''; ?>"  name="Pincode"><br/>                   <span class="description"><?php _e('Please enter your Pincode'); ?></span>            </td>         </tr>                     <?php } elseif (current_filter() == 'category_add_form_fields') {             ?>              <div class="form-field">                 <label for="Pincode"><?php _e('Pincode'); ?></label>                 <input type="text" size="40" value=""  name="Pincode">                 <p class="description"><?php _e('Please enter your Pincode'); ?></p>             </div>                 <?php         } }          add_action('category_edit_form_fields', 'wecode_category_fields', 10, 2);     add_action('category_add_form_fields', 'wecode_category_fields', 10, 2);           function wecode_save_category_fields($  term_id) {         if ( isset( $  _REQUEST['Pincode'] ) ) {              $  Pincode = $  _REQUEST['Pincode'];                                   update_term_meta( $  term_id, 'Pincode', $  Pincode );            }  }     add_action('edited_category', 'wecode_save_category_fields', 10, 2);     add_action('create_category', 'wecode_save_category_fields', 10, 2);  

WordPress meta query for serialize associated array meta value

Serialize array value is:

a:13:{s:7:"relaxed";a:7:{s:4:"name";s:7:"Relaxed";s:5:"votes";i:377;s:7:"term_id";s:5:"28595";s:4:"slug";s:7:"relaxed";s:4:"rank";i:1;s:6:"status";b:1;s:4:"icon";s:70:"https://example.com/wp-content/uploads/2020/12/Relaxed.svg";}s:5:"happy";a:7:{s:4:"name";s:5:"Happy";s:5:"votes";i:293;s:7:"term_id";s:5:"28596";s:4:"slug";s:5:"happy";s:4:"rank";i:2;s:6:"status";b:1;s:4:"icon";s:68:"https://example.com/wp-content/uploads/2020/12/Happy.svg";}s:8:"euphoric";a:7:{s:4:"name";s:8:"Euphoric";s:5:"votes";i:267;s:7:"term_id";s:5:"28597";s:4:"slug";s:8:"euphoric";s:4:"rank";i:3;s:6:"status";b:1;s:4:"icon";s:71:"https://example.com/wp-content/uploads/2020/12/Euphoric.svg";}s:8:"uplifted";a:7:{s:4:"name";s:8:"Uplifted";s:5:"votes";i:191;s:7:"term_id";s:5:"28598";s:4:"slug";s:8:"uplifted";s:4:"rank";i:4;s:6:"status";b:1;s:4:"icon";s:71:"https://example.com/wp-content/uploads/2020/12/Uplifted.svg";}s:6:"sleepy";a:7:{s:4:"name";s:6:"Sleepy";s:5:"votes";i:181;s:7:"term_id";s:5:"28599";s:4:"slug";s:6:"sleepy";s:4:"rank";i:5;s:6:"status";b:1;s:4:"icon";s:69:"https://example.com/wp-content/uploads/2020/12/Sleepy.svg";}s:6:"hungry";a:7:{s:4:"name";s:6:"Hungry";s:5:"votes";i:178;s:7:"term_id";s:5:"28600";s:4:"slug";s:6:"hungry";s:4:"rank";i:6;s:6:"status";b:1;s:4:"icon";s:69:"https://example.com/wp-content/uploads/2021/01/Hungry.svg";}s:6:"giggly";a:7:{s:4:"name";s:6:"Giggly";s:5:"votes";i:122;s:7:"term_id";s:5:"28602";s:4:"slug";s:6:"giggly";s:4:"rank";i:7;s:6:"status";b:1;s:4:"icon";s:69:"https://example.com/wp-content/uploads/2021/01/Giggly.svg";}s:8:"creative";a:7:{s:4:"name";s:8:"Creative";s:5:"votes";i:109;s:7:"term_id";s:5:"28601";s:4:"slug";s:8:"creative";s:4:"rank";i:8;s:6:"status";b:1;s:4:"icon";s:71:"https://example.com/wp-content/uploads/2021/01/Creative.svg";}s:6:"tingly";a:7:{s:4:"name";s:6:"Tingly";s:5:"votes";i:107;s:7:"term_id";s:5:"28605";s:4:"slug";s:6:"tingly";s:4:"rank";i:9;s:6:"status";b:1;s:4:"icon";s:69:"https://example.com/wp-content/uploads/2021/01/Tingly.svg";}s:7:"focused";a:7:{s:4:"name";s:7:"Focused";s:5:"votes";i:102;s:7:"term_id";s:5:"28603";s:4:"slug";s:7:"focused";s:4:"rank";i:10;s:6:"status";b:1;s:4:"icon";s:70:"https://example.com/wp-content/uploads/2021/01/focused.svg";}s:9:"talkative";a:7:{s:4:"name";s:9:"Talkative";s:5:"votes";i:99;s:7:"term_id";s:5:"28606";s:4:"slug";s:9:"talkative";s:4:"rank";i:11;s:6:"status";b:1;s:4:"icon";s:72:"https://example.com/wp-content/uploads/2021/01/Talkative.svg";}s:7:"aroused";a:7:{s:4:"name";s:7:"Aroused";s:5:"votes";i:74;s:7:"term_id";s:5:"28607";s:4:"slug";s:7:"aroused";s:4:"rank";i:12;s:6:"status";b:1;s:4:"icon";s:70:"https://example.com/wp-content/uploads/2021/01/Aroused.svg";}s:9:"energetic";a:7:{s:4:"name";s:9:"Energetic";s:5:"votes";i:65;s:7:"term_id";s:5:"28604";s:4:"slug";s:9:"energetic";s:4:"rank";i:13;s:6:"status";b:1;s:4:"icon";s:72:"https://example.com/wp-content/uploads/2021/01/Energetic.svg";}} 

And data in array format:

Array (     [relaxed] => Array         (             [name] => Relaxed             [votes] => 377             [term_id] => 28595             [slug] => relaxed             [rank] => 1             [status] => 1             [icon] => https://example.com/wp-content/uploads/2020/12/Relaxed.svg         )      [happy] => Array         (             [name] => Happy             [votes] => 293             [term_id] => 28596             [slug] => happy             [rank] => 2             [status] => 1             [icon] => https://example.com/wp-content/uploads/2020/12/Happy.svg         )      [euphoric] => Array         (             [name] => Euphoric             [votes] => 267             [term_id] => 28597             [slug] => euphoric             [rank] => 3             [status] => 1             [icon] => https://example.com/wp-content/uploads/2020/12/Euphoric.svg         )      [uplifted] => Array         (             [name] => Uplifted             [votes] => 191             [term_id] => 28598             [slug] => uplifted             [rank] => 4             [status] => 1             [icon] => https://example.com/wp-content/uploads/2020/12/Uplifted.svg         )      [sleepy] => Array         (             [name] => Sleepy             [votes] => 181             [term_id] => 28599             [slug] => sleepy             [rank] => 5             [status] => 1             [icon] => https://example.com/wp-content/uploads/2020/12/Sleepy.svg         )      [hungry] => Array         (             [name] => Hungry             [votes] => 178             [term_id] => 28600             [slug] => hungry             [rank] => 6             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Hungry.svg         )      [giggly] => Array         (             [name] => Giggly             [votes] => 122             [term_id] => 28602             [slug] => giggly             [rank] => 7             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Giggly.svg         )      [creative] => Array         (             [name] => Creative             [votes] => 109             [term_id] => 28601             [slug] => creative             [rank] => 8             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Creative.svg         )      [tingly] => Array         (             [name] => Tingly             [votes] => 107             [term_id] => 28605             [slug] => tingly             [rank] => 9             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Tingly.svg         )      [focused] => Array         (             [name] => Focused             [votes] => 102             [term_id] => 28603             [slug] => focused             [rank] => 10             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/focused.svg         )      [talkative] => Array         (             [name] => Talkative             [votes] => 99             [term_id] => 28606             [slug] => talkative             [rank] => 11             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Talkative.svg         )      [aroused] => Array         (             [name] => Aroused             [votes] => 74             [term_id] => 28607             [slug] => aroused             [rank] => 12             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Aroused.svg         )      [energetic] => Array         (             [name] => Energetic             [votes] => 65             [term_id] => 28604             [slug] => energetic             [rank] => 13             [status] => 1             [icon] => https://example.com/wp-content/uploads/2021/01/Energetic.svg         )  ) 

I want to match the slug and get rank between 1 to 5 only. Let me know if there any solution for this.

How to copy an order item meta from the parent to the child order in a Woocommerce Subscription?

I’m running a function hooked to woocommerce_order_status_completed that uses an API to get a phone number and pin from an external source and save that in a meta key on some order items. Some of these order items are subscriptions.

When a Woocommerce subscription renewal order runs automatically, it fires the API and gets a new set of call-in data. I need to check if a completed order is a subscription renewal and if so skip the API call and just get the renewed item’s parent meta data and insert it into the child items meta.

The top portion of the code I have tried here is not working. The API call portion of the code in the else{} is working so I have truncated it.

add_action ( 'woocommerce_order_status_completed', 'add_item_meta_or_run_api', 10 , 1);  function add_item_meta_or_run_api( $  order_id ) {  $  order = wc_get_order( $  order_id );   if (wcs_order_contains_subscription( $  order, 'renewal' )){ //check if the order contains a renewal subscription    foreach ($  order->get_items() as $  item_id => $  item_obj) { //loop through each rewnewal item        $  parent_id = $  item_obj->get_parent_id(); // Get the parent order ID for the subscriptions.       $  parentSubscriptions = wcs_get_subscriptions_for_order( $  parent_id );//get parent order subscriptions                 foreach (  $  parentSubscriptions->get_items() as $  parent_item_id => $  subscription_item_obj) { //loop through parent order items and get the meta.                   $  ParentCallinData = $  subscription_item_obj->get_meta('call_in_data');               // Store parenent item call in data in renewal order item meta         wc_update_order_item_meta($  item_id,'call_in_data',   $  ParentCallinData, true);             }    } }   else {//if there is not a subscription renewal in the order then we run the Api       foreach ($  order->get_items() as $  item_id => $  item_obj) {    //Code here has been removed that builds and runs the API call to dynamically get the call-in data and store it in $  APIresponse          wc_update_order_item_meta($  item_id,'call_in_data',  $  APIresponse, true); //the APIresponse is added to an order item meta key     }    }   }