How do I use fields => ids in an array with WP Query?

Why is $args null? $args is just a plain PHP array of query arguments. Arrays in PHP do not have properties (like $args->posts). The ->posts property only exists after you instantiate a WP_Query object. So at that point in your code, $args->posts will always be null or throw an error, because $args is not a … Read more

how to make the link of comment section “nofollow” safely?

to customise the link “You must be logged in”, you can use that in your template : comment_form([ “must_log_in” => “<a href=\”https://wordpress.stackexchange.com/questions/18007/\”>a question about unicorns</a>”, ]); other arguments are detailed in the official documentation : https://developer.wordpress.org/reference/functions/comment_form/

wp-env fails in GitLab CI with “YIKES! It looks like you’re running this as root”

In some quick testing, I found that if I defined WP_CLI_ALLOW_ROOT=1 after I was already running as root, then WP CLI wouldn’t complain. I don’t know a lot about GitLab CI, unfortunately, but I’d try this to see if it works: image: docker:24.0.7 services: – docker:24.0.7-dind variables: DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: “” before_script: – apk add … Read more

When accessing a wordpress blog, I want to force http when accessing wordpress via xmlrpc otherwise force https

The XML-RPC request is presumably to /xmlrpc.php in the root. In which case you can just make an exception for this at the very top of the .htaccess file (no need for the front-controller to be processed). For example: # Prevent remaining mod_rewrite directives to be processed RewriteRule ^xmlrpc\.php$ – [END] HOWEVER, WordPress itself is … Read more

How to include block style variations for blocks in posts dynamically rendered via the Interactivity API

Block variation styles are parsed and processed through wp_render_block_style_variation_support_styles(). This is marked as private and thus should not be called by third-party code outside WordPress core. This function is called by virtue of being hooked into the render_block_data hook. Thus, if you have a subset of known block structures that may appear, you could consider … Read more

set allowedBlocks to a specific variant

First: It is impossible allowedBlocks only accepts block names as strings — not specific variations or object definitions. Second: What’s the correct approach? Use the base block name, then define the variation via className or attributes in the template. How to find a variation’s className? Insert the block (e.g., core/group) and select the desired variation. … Read more

Hook to modify content on a column on the edit.php (list of posts page)?

you can do this customisation by removing the core author column and replace it with a custom one. $post_type = “kea_activity”; add_filter(“manage_{$post_type}_posts_columns”, function ($posts_columns) { $posts_columns[“author_custom”] = “Author”; unset($posts_columns[“author”]); return $posts_columns; }); add_action(“manage_{$post_type}_posts_custom_column”, function ($column_name, $post_ID) { if (“author_custom” === $column_name) { $author = get_the_author(); echo esc_html($author) . ” <strong>information</strong>”; } }, 10, 2);

Which approach for managing automatic updates would be more robust?

I don’t think your first snippet is doing what you’ve intended. The third argument to wp_schedule_event is a hook name, which in your case is wp_automatic_updater. This means that as soon as this event is fired, it will run: do_action( ‘wp_automatic_updater’ ); From a quick look at the WordPress codebase, I don’t see anything scheduled … Read more