Activate and deactivate two plugins automatically at certain hours

Rather than update the database you could write a mu-plugin to intercept reads from the active_plugins option, e.g. function option_active_plugins_akismet_or_yoast( $plugins ) { if ( !defined(‘WP_ADMIN’) ) { $hour = getdate()[ ‘hours’ ]; if ( $hour >= 10 && $hour < 19 ) { $to_remove=”wordpress-seo/wp-seo.php”; } else { $to_remove=”akismet/akismet.php”; } $remove_index = array_search( $to_remove, $plugins … Read more

How to change this WP logo and posts url in block editor?

You can change the logo in the block editor or site editor using the SlotFill system. Have a look at the this example code taken from https://developer.wordpress.org/block-editor/reference-guides/slotfills/main-dashboard-button/ import { registerPlugin } from ‘@wordpress/plugins’; import { __experimentalMainDashboardButton as MainDashboardButton } from ‘@wordpress/edit-post’; const MainDashboardButtonTest = () => ( <MainDashboardButton> Custom main dashboard button content </MainDashboardButton> ); … Read more

wp_query loop with compare operator simply not working, why?

As stated in the documentation: (bold formatting was added by me) Note that meta_query expects nested arrays, even if you only have one query. So your meta query should actually look like the following, and note that in a meta_query, we don’t use the meta_ prefix, e.g. we use just key and not meta_key: $query_args[‘meta_query’] … Read more

What is $post->ID

The post ID. It’s not possible to say any more without more context. If I had to guess $post in this case is a WP_Post object that represents the current post and the author of the post wants to get some posts while excluding the current post. Just be aware that doing so this way … Read more

Get X posts with the same terms as the current post (custom post type and custom taxonomy)

It’s not limiting to 5 posts That’s because the posts_per_page arg should actually be in the same level as the post_type arg and not put inside the tax_query array. I.e. $args = array( ‘post_type’ => ‘oferta’, ‘posts_per_page’ => 5, // add it here ‘tax_query’ => array( array( ‘taxonomy’ => ‘categoria’, ‘posts_per_page’ => 5, // NOT … Read more