In `WP_Theme` class, replace two calls to `file_exists` with a call to the method `is_block_theme`. This method `is_block_theme` does the same file exists check, but it then caches the result for improved performance.
Props nihar007, spacedmonkey, mukesh27, costdev, juzar.
Fixes#58405.
git-svn-id: https://develop.svn.wordpress.org/trunk@55885 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds context to various strings:
- `'Background'` string when referring to Custom Background appearance screens
- `'Header'` string when referring to Custom Header appearance screens
- `'General'`, `'Header'` and `'Footer'` strings when referring to template part areas
Props gonzomir, SergeyBiryukov, mukesh27, costdev, ankitmaru.
Fixes#58424.
git-svn-id: https://develop.svn.wordpress.org/trunk@55881 602fd350-edb4-49c9-b593-d223f7449a82
Use `register_block_type_from_metadata` in `register_core_block_types_from_metadata` function instead of `register_block_type`. This saves an unnecessary call to `file_exists` in `register_block_type` as core block files will always exist.
Props nihar007, spacedmonkey, mukesh27, gziolo, sudipatel007.
Fixes#58342.
git-svn-id: https://develop.svn.wordpress.org/trunk@55879 602fd350-edb4-49c9-b593-d223f7449a82
Includes minor code layout fixes for better readability.
Follow-up to [3061], [31941], [47848], [55622], [55623].
Props aristath, poena, afercia, SergeyBiryukov.
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55878 602fd350-edb4-49c9-b593-d223f7449a82
The `sprintf()` is not being passed any values, and there is no placeholder to replace.
This originated in r52132 in which I erroneously included this `sprintf()` in
two places. I fixed one of the cases in r52151 but I missed the other.
Follow-up to [52132], [52151].
Fixes#58436.
See #44632.
git-svn-id: https://develop.svn.wordpress.org/trunk@55875 602fd350-edb4-49c9-b593-d223f7449a82
Includes minor code layout fixes for better readability.
Follow-up to [9441], [25540].
Props aristath, poena, afercia, SergeyBiryukov.
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55874 602fd350-edb4-49c9-b593-d223f7449a82
Includes minor code layout fixes for better readability.
Follow-up to [3536], [4093], [9578], [11092], [18034].
Props aristath, poena, afercia, SergeyBiryukov.
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55873 602fd350-edb4-49c9-b593-d223f7449a82
Previously when the `mimes` element was not specified in the overrides array passed to `_wp_handle_upload()` it resulted in boolean false being passed to this parameter, which is incorrect. The fallback value should be `null`.
Props platonkristinin, pkbhatt
Fixes#58349
git-svn-id: https://develop.svn.wordpress.org/trunk@55872 602fd350-edb4-49c9-b593-d223f7449a82
Since cron events often consume extra memory by nature, it makes sense to give them the full amount available by default. In practice this means the memory will be increased to `WP_MAX_MEMORY_LIMIT` (which is 256MB by default) during cron event processing if the default memory limit is lower than this value.
The new `cron_memory_limit` filter can be used to adjust this value if necessary.
Note that this change will not by default affect external means of processing cron events, such as the `wp cron` command in WP-CLI, server-level crontab events, or any other cron event processing mechanism that bypasses `wp-cron.php`.
Props iandunn, thakkarhardik
Fixes#56628
git-svn-id: https://develop.svn.wordpress.org/trunk@55871 602fd350-edb4-49c9-b593-d223f7449a82
This moves the query for user ID of the new network's administrator closer to where the value is actually used.
Includes removing unnecessary `get_userdata()` call, as user ID is the only data needed here.
Follow-up to [12756], [35575], [43628].
Props nihar007, sakibmd, mukesh27, costdev, SergeyBiryukov.
Fixes#58423.
git-svn-id: https://develop.svn.wordpress.org/trunk@55869 602fd350-edb4-49c9-b593-d223f7449a82
Includes moving the unit test next to the other `wp_setup_nav_menu_item()` tests and using the `MockAction` class to confirm that the filter runs.
Follow-up to [55867].
Props TobiasBg.
Fixes#56577.
git-svn-id: https://develop.svn.wordpress.org/trunk@55868 602fd350-edb4-49c9-b593-d223f7449a82
Fixes a performance issue where the JIT logic is invoked for every translation call if the there are no translations in the current locale. With this change, the information is cached by adding `Noop_Translations` instances to the global `$l10n` array. This way, `get_translations_for_domain()` returns earlier, thus avoiding subsequent `_load_textdomain_just_in_time()` calls.
Props swissspidy, johnbillion, ocean90.
Fixes#58321.
git-svn-id: https://develop.svn.wordpress.org/trunk@55865 602fd350-edb4-49c9-b593-d223f7449a82
The Change button is supposed to perform the “Change role to...” action only, but could unintentionally be used for other bulk actions if the role was not selected.
This commit removes an extra check and ensures the correct error message is displayed in that case:
Sorry, you are not allowed to give users that role.
Follow-up to [6990], [8691], [9028], [15576], [15642], [34636], [49944].
Props haritpanchal, costdev, ankit-k-gupta, SergeyBiryukov.
Fixes#57952.
git-svn-id: https://develop.svn.wordpress.org/trunk@55864 602fd350-edb4-49c9-b593-d223f7449a82
Refactors the function to avoid unnecessary `get_locale()` calls and slightly improve performance, while keeping it readable.
Adds tests.
Props Cybr, spacedmonkey, swissspidy.
Fixes#58317.
git-svn-id: https://develop.svn.wordpress.org/trunk@55862 602fd350-edb4-49c9-b593-d223f7449a82
* Removes script from the `wp_print_footer_scripts` action in Twenty Nineteen, Twenty Twenty, and Twenty Twenty-One.
* Switches enqueue functions to just register the scripts in Twenty Fifteen, Twenty Sixteen, and Twenty Seventeen.
* Rearranges Twenty Seventeen's scripts to connect `twentyseventeenScreenReaderText` with the global script instead of the unused skip link fix.
* Updates scripts in Twenty Fifteen and Twenty Sixteen with code from Twenty Seventeen _to run on Internet Explorer only_. Twenty Sixteen needed to keep an adjustment that offsets the toolbar and border.
* Removes the script from JS files in Twenty Thirteen and Twenty Fourteen and edits their modified dates.
Props sabernhardt, westonruter, joedolson, flixos90, mukesh27.
Fixes#54421.
git-svn-id: https://develop.svn.wordpress.org/trunk@55861 602fd350-edb4-49c9-b593-d223f7449a82
Previously, when scaling an image larger than the source size in the image edit states the image would silently fail the scaling action. This patch provides an error when someone attempts to scale an image larger than the source size while also disabling the button to initiate the action.
Props brookedot, joedolson, markoheijnen, mikeschroder, desrosj, Mista-Flo, costdev.
Fixes#26381.
git-svn-id: https://develop.svn.wordpress.org/trunk@55859 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds support for schwa character. Ə (U+018F) and ə (U+0259) are part of Latin Extended-B and used in
several languages like Azerbaijani or also in gender neutral Italian.
Props suleymankenar, audrasjb, przemekhernik.
Fixes#57609.
git-svn-id: https://develop.svn.wordpress.org/trunk@55858 602fd350-edb4-49c9-b593-d223f7449a82
This corrects the placement of double quotes around the query and makes sure the alignment is consistent.
Props umeshmcakadi, mukesh27, krupalpanchal, dhrumilk, SergeyBiryukov.
Fixes#58372.
git-svn-id: https://develop.svn.wordpress.org/trunk@55857 602fd350-edb4-49c9-b593-d223f7449a82
As of [55855] wp_queue_comments_for_comment_meta_lazyload was deprecated. But deprecate to wp-admin/deprecated.php and not wp-includes/deprecated.php.This is incorrect, as this is a public function and not an admin function.
Props SergeyBiryukov, spacedmonkey.
See #58301.
git-svn-id: https://develop.svn.wordpress.org/trunk@55856 602fd350-edb4-49c9-b593-d223f7449a82
As of [55749] wp_queue_comments_for_comment_meta_lazyload is no longer used in core. This commit, deprecates this function. Update docs and tests accordingly.
Props sh4lin, spacedmonkey, costdev, peterwilsoncc.
Fixes#58301.
git-svn-id: https://develop.svn.wordpress.org/trunk@55855 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that the option `can_compress_scripts` is autoloaded on single sites, as this option is used in all requests. This change saves one database query per page request.
Props RavanH, spacedmonkey, costdev, azaozz, flixos90.
Fixes#55270.
git-svn-id: https://develop.svn.wordpress.org/trunk@55854 602fd350-edb4-49c9-b593-d223f7449a82
`isset()` is faster than `current_user_can()`, so should be checked first.
Includes updating code layout for better readability.
Follow-up to [19442], [19524], [28477], [33466], [55848].
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55853 602fd350-edb4-49c9-b593-d223f7449a82
The changeset [55695] introduced a regression in the order of styles for the editor, causing the styles registered for the block (both editor and front) to be loaded after any other styles enqueued using the `enqueue_block_editor_assets` hook.
Since the original behavior was introduced in WordPress 5.0 changing it breaks the expectations of the ecosystem.
Props ellatrix.
Fixes#58208.
git-svn-id: https://develop.svn.wordpress.org/trunk@55852 602fd350-edb4-49c9-b593-d223f7449a82
When using a block theme, `_wp_array_get()` is the most called function on the front end of a site.
This commit makes a few minor performance optimizations, which add up to a noticeable improvement.
Follow-up to [49135], [49143], [49580].
Props aristath, jrf, afercia, costdev, swissspidy, flixos90, spacedmonkey, mukesh27, samiamnot, SergeyBiryukov.
Fixes#58376.
git-svn-id: https://develop.svn.wordpress.org/trunk@55851 602fd350-edb4-49c9-b593-d223f7449a82
The `wp_filter_content_tags()` function, which modifies image tags for example to optimize performance, is hooked into the `the_content` filter by default. When rendering an excerpt for a post that doesn't have a manually provided excerpt, the post content is used to generate the excerpt, handled by the `wp_trim_excerpt()` function.
Prior to this changeset, this led to `wp_filter_content_tags()` being called on the content when generating the excerpt, which is wasteful as all tags are stripped from the excerpt, and it furthermore could result in a lazy-loading bug when the post content contained images, as those images were being counted even though they would never be rendered as part of the excerpt.
This changeset fixes the bug and slightly improves performance for generating an excerpt by temporarily unhooking the `wp_filter_content_tags()` function from the `the_content` filter when using it to generate the excerpt.
Props costdev, flixos90, joemcgill, mukesh27, salvoaranzulla, spacedmonkey, thekt12, westonruter.
Fixes#56588.
git-svn-id: https://develop.svn.wordpress.org/trunk@55850 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a small interface glitch in the `Go to Updates` link located on
the the About screen.
Props NekoJonez, mukesh27, sumitbagthariya16, ahsannayem.
Fixes#58373.
git-svn-id: https://develop.svn.wordpress.org/trunk@55848 602fd350-edb4-49c9-b593-d223f7449a82
When the logic to exclude images that likely appear above the fold from being lazy-loaded was introduced in WordPress 5.9, initially only images that appear within the main query loop were being considered. However, there is a good chance that images above the fold are rendered before the loop starts, for example in the header template part.
It is particularly common for a theme to display the featured image for a single post in the header. Based on HTTP Archive data from February 2023, the majority of LCP images that are still being lazy-loaded on WordPress sites use the `wp-post-image` class, i.e. are featured images.
This changeset enhances the logic in `wp_get_loading_attr_default()` to not lazy-load images that appear within or after the header template part and before the query loop, using a new `WP_Query::$before_loop` property.
For block themes, this was for the most part already addressed in [55318], however this enhancement implements the solution in a more generally applicable way that brings the improvement to classic themes as well.
Props thekt12, flixos90, spacedmonkey, costdev, zunaid321, mukesh27.
Fixes#58211.
See #53675, #56930.
git-svn-id: https://develop.svn.wordpress.org/trunk@55847 602fd350-edb4-49c9-b593-d223f7449a82
In [55569] `get_pages` was converted to use `WP_Query` internally. But for plugins that were extending the `get_pages` filters and filter `WP_Query` query arguments, this could result in a conflict. Add a filter `get_pages_query_args` to allow developers to change arguments passed to `WP_Query` but also have the context of the original arguments passed to the `get_pages` function.
This change also expands test coverage of `get_pages` to ensure no breakages in the future.
Props spacedmonkey, westonruter, costdev, flixos90, kenwins, marianne38.
See #12821.
git-svn-id: https://develop.svn.wordpress.org/trunk@55845 602fd350-edb4-49c9-b593-d223f7449a82
In [55818] did a check to see if `WP_Metadata_Lazyloader` class existed and the loaded in the class file if it did not. However, require in wp-settings.php was not removed and resulted in the class being loaded twice. To be safe, only include the class file in meta.php and remove from wp-settings.php file.
Props spacedmonkey, ryelle.
See #58185.
git-svn-id: https://develop.svn.wordpress.org/trunk@55826 602fd350-edb4-49c9-b593-d223f7449a82
In order to skip lazy-loading the first few images on a page, as of WordPress 5.9 there has been logic to count images that are eligible based on certain criteria. One of those groups are images that appear within the content of a post.
This changeset fixes a bug where images created via `get_the_post_thumbnail()` or `wp_get_attachment_image()` that are injected into the post content would skew the count and therefore result in all images to be lazy-loaded, potentially hurting load time performance. This is relevant for example when those functions are called in server-side rendered blocks, or any other filter callbacks hooked into `the_content`.
Props flixos90, antpb, joedolson, spacedmonkey, mukesh27, thekt12, costdev, jrf.
Fixes#58089.
See #53675.
git-svn-id: https://develop.svn.wordpress.org/trunk@55825 602fd350-edb4-49c9-b593-d223f7449a82