New Plugin Review

Now I’ve seen your code, I think the reviewer is wrong: they’re talking about the form in agg-as-options.php, which is handled the way I describe below except they’re wrong: the form is processed in the agg_options function, not outside of a function as they say this is only shown and processed on the admin aggregate-options … Read more

How to prevent action in ajax request, when in admin side?

After testing a lot of things, I found this function, which works: function is_admin_request() { /** * Get current URL. * * @link https://wordpress.stackexchange.com/a/126534 */ $current_url = home_url( add_query_arg( null, null ) ); /** * Get admin URL and referrer. * * @link https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/pluggable.php#L1076 */ $admin_url = strtolower( admin_url() ); $referrer = strtolower( wp_get_referer() ); … Read more

Is there a better way to implement responsive images than what WordPress uses by default?

Unfortunately, I’ve found the images within Gutenberg/block editor a lot left to be desired and the development work with images in 2020 has been primarily focused on adding cropping, rotating images within the block editor. The limitations of responsive images in the block editor is one of my biggest criticisms of the block editor. What … Read more

How to allow core Gutenberg blocks selection only when you are inside a custom inner block

You will need to filter the template for the post type: add_action( ‘init’, ‘setup_template’ ); function setup_template() { $post_object = get_post_type_object( ‘post’ ); $post_object->template = [ [ ‘your/custom/block’ ] ]; $post_object->template_lock = ‘all’; } This will pre-populate the post with a single instance of your custom block and lock it from being changed. By locking … Read more