Is there a way to natively return the full filesystem path when using $wp_styles?

Is there a way to natively return the full filesystem path when using $wp_styles? No because the style engine is never given the filesystem path, it is only given the source URL of the style to be registered/enqueued via wp_enqueue_style: wp_enqueue_style( string $handle, string $src=””, string[] $deps = array(), string|bool|null $ver = false, string $media=”all” … Read more

is_singular() in mu-plugins not working

When the active_plugins option is retrieved, WordPress does not yet know what page has been requested, so this approach will not work. In order to achieve your objective, you would selectively activate the plugin (rather than selectively deactivate the plugin), but this may cause problems and destabilize your site (untested): add_filter( ‘option_active_plugins’, static function ( … Read more

Problem assigning by reference [closed]

The issue is that you’re attempting to store output of a method by reference to $starredgroup_products, which is not possible. This should fix it (untested): $starredgroup = $myPage->getGroup( $starredgroup ); $starredgroup_id = $starredgroup[‘groupid’]; $starredgroup_products = $myPage->getStarredProducts( $starredgroup_id );

Get field added via attachment_fields_to_edit filter in Gutenberg

Yes, you’re right that the slimImageObject function is the reason why you’re seeing/getting only those limited list of props. But don’t worry, you can use wp.data.select( ‘core’ ).getMedia( <attachment id> ) to get the attribution meta (and any other meta or props in the full attachment object). Here’s an example that worked for me: items.map((item, … Read more

Site Health and PHP 8.1

No, the constants WP_HOME and WP_SITEURL are not required to be defined. These constants would overwrite the URLs in the Settings > General fields, so for most sites they are undefined.

How should esc_url be combined with trailingslashit?

It is recommended to escape as late as possible, but the function simply adds a trailing slash (/) (after removing existing one, if any), and I noticed core also used trailingslashit( esc_url() ), so I guess that’s how we would do it. But that is not a definitive answer to your question (which is interesting, … Read more

Strip and print only the numbers found in current’s post excerpt (even if they are without space)

If you have a strict list of allowed years: $allowed_years = array(‘2018’, ‘2019’, ‘2020’, ‘2021’, ‘2022’, ‘2023’, ‘2024’); Then why are you using regex when you can search for those years directly: function vyperlook_get_years_in_text( string $text, array $allowed_years ) : array { $found_years = []; // the years we found // for each year that … Read more