Title: unuinplus's Replies | WordPress.org

---

# unuinplus

  [  ](https://wordpress.org/support/users/unuinplus/)

 *   [Profile](https://wordpress.org/support/users/unuinplus/)
 *   [Topics Started](https://wordpress.org/support/users/unuinplus/topics/)
 *   [Replies Created](https://wordpress.org/support/users/unuinplus/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/unuinplus/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/unuinplus/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/unuinplus/engagements/)
 *   [Favorites](https://wordpress.org/support/users/unuinplus/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YASR - Yet Another Star Rating Plugin for WordPress] How to target custom fields from meta_value](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/)
 *  Thread Starter [unuinplus](https://wordpress.org/support/users/unuinplus/)
 * (@unuinplus)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/#post-16702213)
 * After a lot of debug, I found some of the weird issues.
    1. Schema is not generated if “Enable stars next to the title?” is Disabled
    2. Schema is not generated only after someone votes the article
    3. Schema is not generated if ingredients fields are left empty
 * Also, I have tried your code better, and it seems that if I complete some of 
   the fields after it loads the values automatically, it wont save my new added
   values. Anyway.. in my case I need it more customized, as I am using it in combination
   with Automatic plugin. Thats why is also so important the custom_fields option
   to have it available, so I can target the text area fields to be filled automatically.
 * Oh well.. so far the code I made it here [https://pastebin.com/tEZGsxxk](https://pastebin.com/tEZGsxxk)
   solves some of my needs.
 * But please, try to address the issues above and fix them somehow, as the most
   annoying one is the 2nd one.
 * As a side note/suggestion, try to make it to load by default the tags/keywords,
   name,categories and description, as it would make more sense, because those fields
   are already filled up most of the time when you create an article.
    -  This reply was modified 3 years, 1 month ago by [unuinplus](https://wordpress.org/support/users/unuinplus/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YASR - Yet Another Star Rating Plugin for WordPress] How to target custom fields from meta_value](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/)
 *  Thread Starter [unuinplus](https://wordpress.org/support/users/unuinplus/)
 * (@unuinplus)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/#post-16700889)
 * I have made a backup, deleted everything, and left only with the YASR plugin.
   Still didn’t worked. I have tried older versions, and still the schema doesn’t
   show in the frontend code. Again, all these without touching with any code the
   plugin or the theme. It just gets frustrating af. I have tried other plugins 
   with schema and works straight away in showing the schema.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YASR - Yet Another Star Rating Plugin for WordPress] How to target custom fields from meta_value](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/)
 *  Thread Starter [unuinplus](https://wordpress.org/support/users/unuinplus/)
 * (@unuinplus)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/#post-16700765)
 * The code it works, but apparently I have an issue with the plugin itself, without
   having all the codes added.
 * I use two domains, with the exaclty same files and everything, on domain1, the
   schema gets generated (without having any code alterations), but on domain2, 
   it doesn’t show in the page code, and as well I didn’t alter the code. I have
   tried to delete and install the YASR, and also the wordpress itself, but the 
   schema still doesn’t get generated.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YASR - Yet Another Star Rating Plugin for WordPress] How to target custom fields from meta_value](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/)
 *  Thread Starter [unuinplus](https://wordpress.org/support/users/unuinplus/)
 * (@unuinplus)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/#post-16699783)
 * SO I developed the folowing code in functions.php:
 * >  function set_yarpp_meta_on_save_post( $post_id ) {
   > // verifică dacă postarea
   > este nouăif ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id)){
   > return;}$yarpp_meta = array(‘yarpp_display_for_this_post’ => ‘1’);`update_post_meta(
   > $post_id, 'yarpp_meta', serialize( $yarpp_meta ) );`}add_action( ‘save_post’,‘
   > set_yarpp_meta_on_save_post’ );function save_yasr_schema_additional_fields(
   > $post_id ) {$yasr_schema_additional_fields = array(‘yasr_schema_title’ => get_the_title(),‘
   > yasr_recipe_description’ => get_the_excerpt(),‘yasr_recipe_cooktime’ => ”,‘
   > yasr_recipe_keywords’ => ”,‘yasr_recipe_nutrition’ => ”,‘yasr_recipe_preptime’
   > => ”,‘yasr_recipe_recipecategory’ => ”,‘yasr_recipe_recipecuisine’ => ”,‘yasr_recipe_recipeingredient’
   > => ”,‘yasr_recipe_recipeinstructions’ => ”,‘yasr_recipe_video’ => ”);foreach(
   > $yasr_schema_additional_fields as $field_name => $field_value ) { if ( ! empty(
   > $_POST[ $field_name ] ) ) { $yasr_schema_additional_fields[ $field_name ] =
   > sanitize_text_field( $_POST[ $field_name ] ); update_post_meta( $post_id, $
   > field_name, $yasr_schema_additional_fields[ $field_name ] ); } } update_post_meta(
   > $post_id, ‘yasr_schema_additional_fields’, serialize( $yasr_schema_additional_fields));}
   > add_action( ‘save_post’, ‘save_yasr_schema_additional_fields’ );$yasr_schema_additional_fields
   > = get_post_meta( get_the_ID(), ‘yasr_schema_additional_fields’, true );if (
   > $yasr_schema_additional_fields ) {$yasr_schema_additional_fields = unserialize(
   > $yasr_schema_additional_fields );echo $yasr_schema_additional_fields[‘yasr_schema_title’];
   > echo $yasr_schema_additional_fields[‘yasr_recipe_cooktime’]; echo $yasr_schema_additional_fields[‘
   > yasr_recipe_description’]; echo $yasr_schema_additional_fields[‘yasr_recipe_keywords’];
   > echo $yasr_schema_additional_fields[‘yasr_recipe_nutrition’]; echo $yasr_schema_additional_fields[‘
   > yasr_recipe_preptime’]; echo $yasr_schema_additional_fields[‘yasr_recipe_recipecategory’];
   > echo $yasr_schema_additional_fields[‘yasr_recipe_recipecuisine’]; echo $yasr_schema_additional_fields[‘
   > yasr_recipe_recipeingredient’]; echo $yasr_schema_additional_fields[‘yasr_recipe_recipeinstructions’];
   > echo $yasr_schema_additional_fields[‘yasr_recipe_video’];}
 * And I get the following value in the SQL database:
 * > s:600:”a:11:{s:17:”yasr_schema_title”;s:37:”Demo name from post title”;s:23:”
   > yasr_recipe_description”;s:141:”Demo description from excerpt”;s:20:”yasr_recipe_cooktime”;
   > s:0:””;s:20:”yasr_recipe_keywords”;s:0:””;s:21:”yasr_recipe_nutrition”;s:0:””;
   > s:20:”yasr_recipe_preptime”;s:0:””;s:26:”yasr_recipe_recipecategory”;s:0:””;
   > s:25:”yasr_recipe_recipecuisine”;s:0:””;s:28:”yasr_recipe_recipeingredient”;
   > s:0:””;s:30:”yasr_recipe_recipeinstructions”;s:0:””;s:17:”yasr_recipe_video”;
   > s:0:””;}”;
 * But the problem is that I get this error now in the article edit page:
 * > [View post on imgur.com](https://imgur.com/a/DcGXMPw)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YASR - Yet Another Star Rating Plugin for WordPress] How to target custom fields from meta_value](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/)
 *  Thread Starter [unuinplus](https://wordpress.org/support/users/unuinplus/)
 * (@unuinplus)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/#post-16699545)
 * Also, I have tried to use the following code, so I can post automatically in 
   the fields of the fields, but without success:
 * if (isset($_POST[‘yasr_schema_title’])) {
   update_post_meta($post_id, ‘yasr_schema_title’,
   sanitize_text_field($_POST[‘yasr_schema_title’]));}
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YASR - Yet Another Star Rating Plugin for WordPress] How to target custom fields from meta_value](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/)
 *  Thread Starter [unuinplus](https://wordpress.org/support/users/unuinplus/)
 * (@unuinplus)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/how-to-target-custom-fields-from-meta_value/#post-16699437)
 * the comand I am using for is for example: xpath|field_I_want_to_copy|yasr_recipe_cooktime
 * Rule fomat is “extractionMethod|data|customFieldName”
 * extractionMethod can be id,class,xpath or regex, and in my case is xpath or regex.
   The main idea is that when I specify the same thing to excerpt. example: regex
   |<meta name=”description” content=”(.*?)”|excerpt – would copy the description
   in the excerpt field.

Viewing 6 replies - 1 through 6 (of 6 total)