woocommerce – WP WPQuery, not running properly in WP CLI

I’m running a simple query just to find simple WooCommerce products, here is the query which works fine in the header of the site:

$args = array(
    'post_type' => 'product',
    'posts_per_page' => -1,
    'tax_query' => array(
        array(
            'taxonomy' => 'product_type',
            'field' => 'slug',
            'terms' => array('simple')
        ),
    ),
);

$simpleProducts = new WP_Query($args);

This query returns 1065 products which are correct. If I run the same query through a WP CLI command, I get 0 posts… however, if I remove the tax query it’s returns all the products on the site.

Has anyone had this issue with WP CLI?

unity – GameObject LookAt not aligning properly

I have a celestial sphere with a plane in the centre and spheres (stars) aligned around the centre with a fixed radius.

Celestial Sphere Screenshot

In order to show the stars visible from a certain latitude and longitude from Earth, I need to rotate the plane accordingly.

To rotate the plane properly, I converted the latitude and longitude into 3D vectors, then utilised the LookAt() method to point the plane at this vector.

The following is the code which calculated the vectors from the coordinates, and utilises the LookAt() Method:

public void positionLand(double latitude, double longitude)
{
    double latitude_rad = (math.PI / 180) * latitude;
    double longitude_rad = (math.PI / 180) * longitude;

    Vector3 markerPositioning = new Vector3();
    markerPositioning.x = (float)-((math.cos(latitude_rad)) * (math.cos(longitude_rad)));
    markerPositioning.y = (float)((math.cos(latitude_rad)) * (math.sin(longitude_rad)));
    markerPositioning.z = (float)((math.sin(latitude_rad)));

    groundPlane.transform.LookAt(markerPositioning);
}

To test if this would work, I used the coordinates of London, UK, latitude: 51.509865 and longitude: -0.118092. And this was the result:

London coordinates LookAt

With the LookAt() method changed to the following: groundPlane.transform.LookAt(markerPositioning, Vector3.forward);

This is the result:

Vector3.forward

Replacing groundPlane.transform.LookAt(markerPositioning); with groundPlane.transform.up = markerPositioning; results in the following:

enter image description here

As you can see, the plane is not properly rotating. Initially, I thought maybe the LookAt() method is using the incorrect forward vector of the plane gameobject, but this isn’t the case as there is no connection between the way the plane rotated and the coordinates of London as the plane is near vertical at 89 degrees.

What am I doing wrong and how can I fix this?

web server – How properly manage several webapps on one domain nginx

as in title I’m trying to setup several webapps (nextcloud, roundcube) on one domain, let’s say example.com, without using cname subdomains. I installed webapps in default location /usr/share/webapps/ and I want this directory to be also my webroot server. How can I achieve effect like this:

example.com -> /usr/share/webapps/index.html
example.com/nextcloud -> /usr/share/webapps/nextcloud/
example.com/roundcube -> /usr/share/webapps/roundcube/

using (if possible) several nginx configurations file? For example, nginx config for nextcloud contains few server blocks while roundcube config from archwiki (server is running Arch Linux) is all written in one location block. How should look nginx configuration to make all this working and with option to easily add new webapps?

guidelines – Problems with posting the first questions even if I get rid of the code? Your post appears to contain code that is not properly formatted as code

I’m relative new to Mathematica and also new to this forum. I tried to post a larger question but somehow the website won’t let me post it and gives me an error: enter image description here

I know that a lot of other people have had similar problems, but I couldn’t find the right solution for me. Even if I get rid of all the code in the question and check the question the same error message appears. And the format of the question looks all right for me. (see the two added screenshots). Is there anything I can do about this? Any help is very much appreciated. Thank you.

enter image description here
enter image description here

group policy – Redirect Known Folder Locations automatically to Onedrive not to working properly (my documents)

We are have planning to migrate our Files to Onedrive4B and as part of the requirements we have been asked to Redirect Known Folders to Onedrive in our case (Desktop, Pictures and Documents).
Our Documents is redirected to H: Mapped Network Drive so whatever is saved in Documents is synced via the Microsoft Sync Center back to H: Network Location whenever the client is in online mode.

Our Onedrive Group Policies look like this

The Challenge here is since our Documents Folder (which is part of the known folders) is not on the local Machine but in a network location how do we handle this?.
We noticed that it was not possible to backup the Documents folder, OneDrive will refuse telling me that “The Documents folder contains other important folders and isn’t supported for file protection.” Contact your IT Department or something.
Similar Description here https://onedrive.uservoice.com/forums/913534-onedrive-security-policy-administration/suggestions/35072257-allow-onedrive-kfm-to-work-with-folder-redirected

This is how the Folders look like when trying to backup Onedrive for Business

So in order to give Onedrive access to my Documents on the local System the plan was to disable Folder Redirection using GPO.

So I did this in a separate group policy which precedes the group policy with all Onedrive settings. https://4sysops.com/archives/how-to-disable-folder-redirection/

I still didn’t see a behaviour change or option deactivated even though corresponding registry key is updated on computers after a policy update. I checked the following location https://www.winhelponline.com/blog/windows-10-shell-folders-paths-defaults-restore/

HKEY_CURRENT_USERSOFTWAREMicrosoftWindowsCurrentVersionExplorerUser Shell Folders

Shell Folder Name — Value type: REG_EXPAND_SZ: Personal
Location: %USERPROFILE%Documents

I found an interesting article here https://lazyadmin.nl/office-365/migrate-users-home-drives-to-onedrive-for-business-with-powershell/ that seem to be talking on the same lines but i am not too sure if this is the way to go.

Some recommendations could help

plugin development – How to get boolean value from register_meta properly?

I registered boolean by register_meta(), to use it in my Gutenberg Plugin Sidebar,
I added default value to it true:

register_meta( 'post', '_thefuturmeta_post_title_visibility', array(
    'show_in_rest' => (
        'schema' => (
            'type'    => 'boolean',
            'default' => true,
        )
    ),
    'type' => 'boolean',
    'single' => true,
    'sanitize_callback' => 'sanitize_text_field',
    'auth_callback' => function() {
        return current_user_can( 'edit_posts' );
    }
) );

So after registering I can see its value in my console, then by my Gutenberg Sidebar I added ToggleControl and can change this value, and everything’s working perfect.

But I can’t get my value properly in my theme:

$visibility_title = get_post_meta( get_the_ID(), '_thefuturmeta_post_title_visibility', true );
var_dump($visibility_title);

var_dump() will always show boolean(true), if I change default value in get_post_meta to false like this:

$visibility_title = get_post_meta( get_the_ID(), '_thefuturmeta_post_title_visibility', false );

I will get bool(false) even if in my sidebar plugin I have true, but If I switch in my sidebar plugin to false and save and again switch to true, after this $visibility_title will be showing always right values depending on ToggleControl.

What am I doing wrong? I’m sure I have problem exactly here:

$visibility_title = get_post_meta( get_the_ID(), '_thefuturmeta_post_title_visibility', true );

But I can’t understand what’s wrong.

Can you help me, please?

hard drive – New SSD in 2014 MacBook Pro won’t sit properly

I bought an SSD to replace the one that came with my MacBook Pro, mid 2014 retina. It needed an adapter as the connectors were slightly different.

This is the SSD:
https://www.amazon.com/Crucial-1TB-NAND-NVMe-PCIe/dp/B07J2Q4SWZ

This is the adapter:
https://www.amazon.com/QNINE-Convert-Adapter-MacBook-Upgraded/dp/B07LGTMCCX

When I plug the SSD into the adapter, it bends upwards:

enter image description here

When I screwed it down and tested it, it worked without any problems. It still doesn’t look like it’s sitting right:
enter image description here

Could this be causing any damage to the SSD?

unity – Properly updating Singleton variables

I have a GameManager Singleton script, which a public property:

public bool IsDroneDeployed = false

When I set this value to true/false using a script… it seems these two versions of the value are different.

IsDroneDeployed = !IsDroneDeployed;
//GameManager.Instance.IsDroneDeployed

If I set the first one and log it out, the “instance” version isn’t updated.

I would think when I’m in the GameManager, since it’s a singleton I could just directly manipulate the variable, is that not the case?

Here’s part of the code to show what I’m talking about…

public class GameManager : Singleton<GameManager>
{
    public bool IsDroneDeployed = false;
    
    public void LoadMapViewScene() //This is the action I kick off from an onClick event on a panel
    {
        Debug.Log($"=============Loading Map View");
        //LoadLevel(MapViewSceneName);
        SwitchDroneDeployedValue();
    }
        
    public void SwitchDroneDeployedValue()
    {
        Debug.Log($"============= Switching IsDroneDeployed Value BEFORE Switch: {IsDroneDeployed}");
        Debug.Log($"============= Switching GameManager.Instance.IsDroneDeployed value BEFORE Switch: {GameManager.Instance.IsDroneDeployed}");

        IsDroneDeployed = !IsDroneDeployed;
        //GameManager.Instance.IsDroneDeployed = !GameManager.Instance.IsDroneDeployed;
        Debug.Log($"============= Switching IsDroneDeployed value AFTER Switch: {IsDroneDeployed}");
        Debug.Log($"============= Switching GameManager.Instance.IsDroneDeployed value AFTER Switch: {GameManager.Instance.IsDroneDeployed}");
    }
    }

This results in this log..

============= Switching IsDroneDeployed Value BEFORE Switch: False
============= Switching GameManager.Instance.IsDroneDeployed value BEFORE Switch: False
============= Switching IsDroneDeployed value AFTER Switch: True
============= Switching GameManager.Instance.IsDroneDeployed value AFTER Switch: False

You can see that the “Instance” version doesn’t get updated. Why is that?
Only if I update GameManager.Instance.IsDroneDeployed directly

(GameManager.Instance.IsDroneDeployed = !GameManager.Instance.IsDroneDeployed;)  

it updates, but that seems wrong to me because the code is already in this class.