unity – What controls the platform override codes in AudioClip (and maybe other Assets) .meta files?

My game needs to use Unity 2019.3 for the console versions, and 2020.3 for the mobile ports.

The Console Project is the master project. Virtually any changes done to it are replicated to the Mobile project.

I would like to setup import overrides for Android (e.g. the compression quality for my soundtracks). To be consistent, I perform this change in my Console Project using the “Override for Android” checkbox (which affects the .meta file), and then replicate the change to the Mobile Project.

Ideally, the Mobile Project will now reflect the compression quality I want for said soundtracks, but it actually doesn’t – in fact, the “Override for Android” checkbox does not appear to be checked in the Mobile Project, despite having a .meta file identical to the Console Project.

I digged into the .meta files, and noticed that when I use “Override for Android” in my Console Project, the .meta file adds an entry code 27:

  platformSettingOverrides:
    27:
      loadType: 2
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 0.5
      conversionMode: 0

But, when I go to my Mobile Project and check the checkbox, it adds an entry coded 7:

  platformSettingOverrides:
    7:
      loadType: 2
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 0.5
      conversionMode: 0

I don’t understand this inconsistency. Does anyone have any insight on the exact conditions/rules Unity uses for the platform codes in the .meta files?

I can only think of a few dubious reasons:

  1. Maybe they changed from 2019 to 2020.
  2. My Console Project actually supports more platforms than the Mobile Project (the consoles, obviously), so maybe they “pushed” the Android code from 7 to 27.

It is not the end of the world; I could make a script that duplicates the settings of 27 into 7… But only if this behaviour is predictable or consistent. So my question is, what is Unity’s logic behind the choice of these platform codes?

Note: so far I’ve only found this behaviour on AudioClip files. With Textures, I see that it actually uses the name of the platform in the .meta file, so the settings do work thankfully, but it is even more puzzling because now I don’t understand why Textures and AudioClips use different conventions to begin with… What other Asset Type has numeric conventions?

post meta – Why ever use add_post_meta, and not just update_post_meta?

I stumbled across this nice guide on Smashing Magazine on how to add a custom meta box.

In there, I can see this code here, which has me puzzled:

/* Save the meta box’s post metadata. */
function smashing_save_post_class_meta( $post_id, $post ) {

  /* Verify the nonce before proceeding. */
  if ( !isset( $_POST('smashing_post_class_nonce') ) || !wp_verify_nonce( $_POST('smashing_post_class_nonce'), basename( __FILE__ ) ) )
    return $post_id;

  /* Get the post type object. */
  $post_type = get_post_type_object( $post->post_type );

  /* Check if the current user has permission to edit the post. */
  if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
    return $post_id;

  /* Get the posted data and sanitize it for use as an HTML class. */
  $new_meta_value = ( isset( $_POST('smashing-post-class') ) ? sanitize_html_class( $_POST('smashing-post-class') ) : ’ );

  /* Get the meta key. */
  $meta_key = 'smashing_post_class';

  /* Get the meta value of the custom field key. */
  $meta_value = get_post_meta( $post_id, $meta_key, true );

  /* If a new meta value was added and there was no previous value, add it. */
  if ( $new_meta_value && ’ == $meta_value )
    add_post_meta( $post_id, $meta_key, $new_meta_value, true );

  /* If the new meta value does not match the old value, update it. */
  elseif ( $new_meta_value && $new_meta_value != $meta_value )
    update_post_meta( $post_id, $meta_key, $new_meta_value );

  /* If there is no new meta value but an old value exists, delete it. */
  elseif ( ’ == $new_meta_value && $meta_value )
    delete_post_meta( $post_id, $meta_key, $meta_value );
}

What I don’t get is the last couple of lines, where it checks if the post should be added (with add_post_meta()) or updated (with update_post_meta().

I don’t get why make extra lines of code for this? I mean… update_post_meta() adds the field if it wasn’t there.

So what’s the advantages of this code?


By the way… I found the backticks (’) puzzling as well, so I asked about them here.

seo – Google results for my site are showing the title of a hidden modal element instead of my meta description

I have a site that features a listing of companies. Every company has its own page. Every page has its own meta description. There is no nofollow or noindex tag or anything like that.

Yet, instead of the meta description, Google chooses to show the title of an insignificant modal element on the page. This is true for most results from the site. Maybe 10% of results show the meta description correctly.

This behavior is so seemingly random that I have no idea how to help the situation. There is a big H1 title on the page, so if Google is ignoring the meta description, I would expect it to pick that.

The modal is hidden and it’s not even the first modal when you look at the HTML source of the page.

Any suggestions?

version control – What is the **difference** between git-repo and meta tools in the context of multiple git source code repositories?

Regarding the tools repo and meta, in the context of multiple git source code repositories, what is the difference ?

Or do they basically do the same thing?

An article back in 2012 says: “Repo is a tool created by Google (…) works by providing a way to check out multiple projects (Git repositories) (…) provides a way to submit an atomic changeset that includes changes to multiple different projects. (…)” and https://github.com/mateodelnorte/meta says: meta is a tool for managing multi-project systems and libraries. It answers the conundrum of choosing between a mono repo or many repos by saying “both”, with a meta repo! (…) letting you execute them against some or all of the repos in your solution at once

EDIT : My earlier attempt to ask this was deleted for being of type “find or recommend tools… “. Now I am not here now asking for a recommendation, I am just asking are there any concrete difference between them! Thanks!

metabox – Remove action of an external plugin after checking if custom post meta is set

I am writing an add-on for an external plugin, such if a custom post meta exist for the page/post, disable/remove certain action added by the external plugin, as well as action added by my own plugin.

the action that I want to remove from the external plugin is called in a class construction.

class External_Plugin {
  function __construct() {
    add_action( 'wp_footer', array( $this, 'inject-code' ) );
  }
}
new External_Plugin();

I hooked my check post meta code to wp_head as shown below

class My_Plugin {
  function __construct() {
    //check if dependency satisfied
    if (!class_exists('External_Plugin')){
      add_action( 'admin_notices', array( $this,'display_dependency_error_notice' ));
    }else{
      add_action( 'wp_enqueue_scripts', array($this,'my_plugin_enqueue_scripts'));
      add_action( 'wp_head', array( $this, 'check_post_meta' ));
    }
  }

  function check_post_meta(){
    if (!is_admin()&&get_post_meta(get_queried_object_id(), 'fbcp_disable_chat',true)){
      error_log('fired');
      remove_action( 'wp_footer', array('External_Plugin','inject-code',11 ));
      remove_action( 'wp_enqueue_scripts', array($this,'my_plugin_enqueue_scripts'));
    }
  }
}
new My_Plugin()

I can see from the log that my if block in check_post_meta() was indeed fired, but neither the wp_footer action by external plugin nor my wp_enqueue_scripts hooked action got removed.
In my understanding, wp_head hook is already way after the class being constructed, hence my remove_action() are definitely called after the add_action() that I want to remove, but before the hooks these actions are fired. Can someone enlighten me what is wrong with my code, and how to use the remove_action()?

P.S. I am also confused when I can get the post ID in order to retrieve the post meta… why post id is only available by wp_head? as I tried the init hook and I could not get post ID at that stage.

Drupal 9: How to add custom attributes to description meta tag?

I need to add ‘class’ and ‘data-type’ attributes to meta tag containing description attribute. I was able to locate the core Metatag module, however I’m unable to find any documentation on how to customize output without altering the core.

layout – how to add a meta tag to home page only

hello everyone i have added a specific meta-tag to all page of my website , but I want to add it to just the home page , can i achieve that ?

i have added the meta tag like below, but it appears on all website’s pages when i inspect “View page source”

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>

        <meta name="......" content="...." />
    </head>
</page>

can i add it only on home page ?

How to access post meta on the first time a post is published

Am trying to send an email based on the contents of a post published but it should only be done if its the first time the post is published.

Therefore am using add_action( 'transition_post_status', ( $this, 'jackie_publish_post_hook'), 20, 3 );

the callback function jackie_publish_post_hook has the following content.(The full content is quite big and some information is irrelevant to this question therefore i will only include the relative part)

public function jackie_publish_post_hook($new,$old,$post){

$accepted = array('pending','future','draft','auto-draft');
if(in_array($old, $accepted) && $new == 'publish'){
    $attachment = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', true);
    print_r($attachment);
}

My problem occurs when I try to access the any post meta eg the featured image or any custom field as they have not been saved yet to database.

Some solutions have suggested using add_action( 'publish_post', ... ); and then accessing the values from the $_POST variable but when I do this the $_POST returns an empty array.
I have confirmed from the developers tools that the featured image id is being sent as a post parameter with the request but I cannot seem to access it from the given callback.
The POST Request parameters from the browser side

If I force the function to run after a post has been published earlier it returns the correct data. ie running manually.
$this->jackie_publish_post_hook('publish','draft',get_post(70801));

Is there a special way to access the first time submitted data from the hook callback function or what am I doing wrong?

Can I access the post meta from unsaved but submitted data to wordpress?

WordPress theme header.php should I add title meta?

I am making a theme for WordPress and I have noticed that most themes does not have meta in them
Is there any specific reason for this?

Am I allowed to put custom metas such as keywords that are SEO related while publishing to WordPress directory?

Thanks

seo – Website not properly indexed by Google search console says “‘noindex’ detected in ‘robots’ meta tag” while this is not the case

TLTR

I have a website (SPA) where SEO is very important. It was very poorly indexed and search console tells me it is due to ‘noindex’ in the robots meta, while I cannot see how Google comes to that conclusion.

I have this Single Page Application built with VueJS, which I launched at the start of this year. I noticed it was poorly indexed in Google. Google has missed out on indexing indexed a lot of my pages; including the most important ones with the most content. I do control the robots meta tag trough javascript, but cannot see how this would cause these issues.

I will post an example URL here where indexing by Google is blocked, while I want it to be indexed and give all information/research I have found about it:

URLS:

https://trainervinden.nl/blog/afvallen-met-een-personal-trainer

Alternative URL, different page type, same results:
https://trainervinden.nl/trainer/marit-de-heer

Sitemap

The page is part of the sitemap:
https://trainervinden.nl/sitemap.xml

Robots.txt

We don’t have one AFAIK.

Chrome Inspector

I see the robots meta tag in header from Chrome inspector, and it looks good to me:

Meta tag in header from inspector

Page Source

Default robots meta tag from page source (it is a SPA though, and robots meta tag is also controlled by javascript):
Robots meta in Page source from SPA

Web Developer Tools Chrome Plugin

Response headers, looking good to me. No robots stuff here:

Result response headers Web Developer Tools

Meta tags from Web Developer Tools, still looking as I expect:

Meta tags from Web Developer Tools

Google Search Console

Pushing the button Test live url (the same results as the existing info behind tab Google Index) gives results I do not understand:

Result for Test live url

I can provide any extra information needed to solve this issue; just ask!

So basically I have no idea where this “no-index” Google sees is coming from and am a web guy in despair right now. Any hint helping me out is much appreciated; more than you can imagine at this point 🙂