The templates controller now respects the `_fields` parameter and filters the response accordingly. The schema has been updated to include all the fields returned. The `content.block_version` field has been added. The controller now returns WP_Error objects for improved error handling.
Add new unit tests.
Props TimothyBlynJacobs, hellofromtonya, zieladam.
Fixes#54422.
Built from https://develop.svn.wordpress.org/trunk@52186
git-svn-id: http://core.svn.wordpress.org/trunk@51778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On some browser & window size combinations (near where a scrollbar would appear), hovering over the theme card causes a layout shift. This makes the screen visually "jump" as the scrollbar appears and disappears. By forcing the scrollbar to be visible on this page, hovering doesn't cause the layout shift anymore.
Props wparslan, sabernhardt, costdev, audrasjb.
Fixes#53478.
Built from https://develop.svn.wordpress.org/trunk@52185
git-svn-id: http://core.svn.wordpress.org/trunk@51777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The menu items REST API controller was added in [52079]. This included functionality to add a "block" menu item type. This functionality is experimental and not currently used in WordPress core, so should be removed.
Props noisysocks.
See #40878.
Built from https://develop.svn.wordpress.org/trunk@52184
git-svn-id: http://core.svn.wordpress.org/trunk@51776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates `WP_Theme_JSON_Resolver::theme_has_support()` to properly check for a `theme.json` file in both parent and child themes when determining whether a theme supports block templates.
Follow up to [52077].
Props Mamaduka.
Fixes#54401.
Built from https://develop.svn.wordpress.org/trunk@52181
git-svn-id: http://core.svn.wordpress.org/trunk@51773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`get_term()` accepts a term ID, instance of `WP_Term`, or an object (i.e. `stdClass` as a result of a db query). Functions that use `get_term()` also now allow for the same data types.
Why? For consistency, removing extra processing code in consuming functions, and performance.
Functions changed in this commit are:
* `get_category_feed_link()`
* `get_term_feed_link()`
* `get_tag_feed_link()`
* `get_edit_tag_link()`
* `get_edit_term_link()`
* `edit_term_link()`
For each of consumer of these functions, changes to pass the object instead of the term ID.
Includes unit/integration tests for test coverage of these changes.
Follow-up to [6365], [9136], [9340], [14711], [15792], [15800], [18827], [32606], [36646], [37252].
Props davidbinda, johnbillion, peterwilsoncc, hellofromTonya, sergeybiryukov, mista-flo, hareesh-pillai, audrasjb, jeffpaul, chaion07.
Fixes#50225.
Built from https://develop.svn.wordpress.org/trunk@52180
git-svn-id: http://core.svn.wordpress.org/trunk@51772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When the `PHP_CodeSniffer` runs, it produces a cache file. When a cache file is present, only changed files are rescanned, making subsequent scans significantly faster.
This adds the needed steps to the corresponding GitHub Actions workflows to cache these files across runs. The cache keys include the date of the previous Monday to ensure that the cache is flushed at least weekly.
Since GitHub Action caches cannot be updated once created, the scans will take slightly longer as the week progresses and more PHP files are updated. The date within the cache key can be updated to purge twice weekly if the scan time starts to approach the current scan times.
This change also introduces a `.cache` directory for all caching files related to build/test tools.
Props johnbillion, jrf.
Fixes#49783.
Built from https://develop.svn.wordpress.org/trunk@52179
git-svn-id: http://core.svn.wordpress.org/trunk@51771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
For themes without non-block themes (i.e. without a `/block-templates/index.html` file), restores the "Customize" menu item under "Appearance" menu to its original location of `6`.
For block themes, moves it to position `8`, as "Styles" is in position `7` as of [52158].
Follow-up to [29026], [52069], [52158].
Props poena, davidbaumwald, sabernhardt, hellofromTonya.
Fixes#54418.
Built from https://develop.svn.wordpress.org/trunk@52178
git-svn-id: http://core.svn.wordpress.org/trunk@51770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Instead of silently failing when attempting to insert a value into a field, this commit saves the error in the `wpdb::$last_error` property.
Sets `last_error` with an error message if:
* `wpdb::query()` fails for invalid data
* `wpdb::process_fields()` fails to process the value(s) for the field(s) where the value could be too long or contain invalid data
Sets `last_query` if `wpdb::query()` fails for invalid data.
If `__()` is not available, uses non-translated error message to ensure the error is captured.
There is no change to wpdb aborting when an error occurs.
Adds tests.
Props dlt101, mnelson4, dd32, pento, hellofromTonya, davidbaumwald, sergeybiryukov, johnbillion, swissspidy, datainterlock, anandau14, anthonyeden, asif2bd, audrasjb, chaion07, dpegasusm, fpcsjames, galbaras, jdgrimes, justindocanto, kwisatz, liammitchell, lucasw89, lukecarbis, nettsite, nlpro, procodewp, psufan, richardfoley, skunkbad, travisnorthcutt, woodyhayday, zoiec.
Fixes#37267.
Built from https://develop.svn.wordpress.org/trunk@52176
git-svn-id: http://core.svn.wordpress.org/trunk@51768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Though hidden via `style="display:none;"`, if the comments aren't threaded, this commit doesn't output the cancel comment reply link (skips over that logic). Change in `comment_form()`.
Adds tests.
Follow-up to [12810], [38959].
Props henrywright, jigneshnakrani, rachelbaker, desrosj, audrasjb, hellofromTonya.
Fixes#37267.
Built from https://develop.svn.wordpress.org/trunk@52175
git-svn-id: http://core.svn.wordpress.org/trunk@51767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[33696] introduced support returning `ArrayIterator` and `ArrayObject` objects from `WP_Widget::get_settings()`.
Per the PHP manual, `array_key_exists()` stopped supporting this in PHP 8.0.0 and deprecated in PHP 7.4.0.
>For backward compatibility reasons, array_key_exists() will also return true if key is a property defined within an object given as array. This behaviour is deprecated as of PHP 7.4.0, and removed as of PHP 8.0.0.
This commit uses `isset()` instead of `array_key_exists()` which is supported on all current versions of PHP.
Includes unit tests.
Ref:
* https://www.php.net/manual/en/function.array-key-exists.php#refsect1-function.array-key-exists-notes
Follow-up to [32602], [33696].
Props dlh, hellofromTonya, jrf, sergeybiryukov.
Fixes#52728.
Built from https://develop.svn.wordpress.org/trunk@52173
git-svn-id: http://core.svn.wordpress.org/trunk@51765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Based on follow-up research, this change was never necessary in order to use e2e tests in the media library uploader. Additionally, it created several complicated side effects. Without significant benefit, it's not valuable to pursue the change further.
Follow up to [52059].
See #54168, #54411.
Fixes#54168.
Built from https://develop.svn.wordpress.org/trunk@52171
git-svn-id: http://core.svn.wordpress.org/trunk@51763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix bug introduced in [50829] that caused media modal to only load the selected image. Executes `.more()` when loading the modal to ensure that the media collection is available.
Props manishamakhija, birgire, dilipbheda, afercia, hellofromTonya.
Fixes#42937.
Built from https://develop.svn.wordpress.org/trunk@52168
git-svn-id: http://core.svn.wordpress.org/trunk@51760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix bug introduced in [50829] that caused media modal to only load the selected image. Executes `.more()` when loading the modal to ensure that the media collection is available.
Props benitolopez, hellofromTonya, peterwilsoncc, danielbachhuber, PieWP, sabernhardt, szaqal21.
Fixes#53765.
Built from https://develop.svn.wordpress.org/trunk@52167
git-svn-id: http://core.svn.wordpress.org/trunk@51759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Avoid a fatal error due to `WP_Theme_JSON_Schema` and potentially other classes and/or functions redeclarations when updating to WordPress 5.9 with an incompatible version of the Gutenberg plugin.
This commit uses the same strategy from 5.8. Moves the plugin deactivation code (introduced in [51266]) to a private function for reuse in 5.8, 5.9, and future major releases.
Follow-up to [51180], [51266].
Props hellofromTonya, johnbillion, jorbin.
See #54405.
Built from https://develop.svn.wordpress.org/trunk@52165
git-svn-id: http://core.svn.wordpress.org/trunk@51757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Updates `theme.json` to use v2 shape, adds styles to search and file block as well as generic text decoration. Fixes a bug in the layout of a query block pattern.
This is a follow-up to [52081]. These changes are ongoing and development continues on GitHub. To view all of the changes included in this commit, see GitHub: 99db6063be...a11fb4932a
Props desrosj, kjellr, poena.
See #54318.
Built from https://develop.svn.wordpress.org/trunk@52164
git-svn-id: http://core.svn.wordpress.org/trunk@51756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Update the label names to make it clear that these descriptions are not for the term name or slug itself, but for the Name, Slug, Parent, and Description fields:
* `name_field_description`
* `slug_field_description`
* `parent_field_description`
* `desc_field_description`
* Update the array structure to make it clear that the default values for these labels are the same for both hierarchical and non-hierarchical taxonomies, with the exception of `parent_field_description`.
* Add documentation and a `@since` note for the new labels.
Follow-up to [52094].
Fixes#43060.
Built from https://develop.svn.wordpress.org/trunk@52163
git-svn-id: http://core.svn.wordpress.org/trunk@51755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update packages to include these bug fixes from Gutenberg:
- Navigation: Fix click-button size, submenu directions, scrollbars.
- Group - Fix overzealous regex when restoring inner containers
- Babel Preset: Update Babel packages to 7.16 version
- theme.json: adds a setting property that enables some other ones
- Polish metabox container.
- Fix submenu justification and spacer orientation.
- Fix Gutenberg 11.8.2 in WordPress trunk
- Strip meta tags from pasted links in Chromium
- Hide visilibility and status for navigation posts
- Navigation: Refactor and simplify setup state.
- Nav block menu switcher - decode HTML entities and utilise accessible markup pattern
- Rename fse_navigation_area to wp_navigation_area
- theme.json: adds a setting property that enables some other ones
- Revert "theme.json: adds a setting property that enables some other ones"
- Skip flaky image block test
- WordPress/gutenberg@3c935c4
- React to any errors coming up in gutenberg_migrate_menu_to_navigation_post
- Return wp error from wp_insert_post
- Fix not transforming logical assignments for packages
See #54337.
Built from https://develop.svn.wordpress.org/trunk@52161
git-svn-id: http://core.svn.wordpress.org/trunk@51753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On multisite, when checking if a user has a certain capability WordPress makes an additional check to see if the user is a super admin. The `is_super_admin()` function contained a call to `wp_get_current_user()` so as the global current user object could be used if it matched the queried user id.
This would cause an infinite loop if a hook attached to the `determine_current_user` filter was itself making a permission check. For example when limiting who can use the Application Passwords feature based on their capabilities.
Since [50790] the `WP_User` instance for the current user is shared between `wp_get_current_user()` and `get_userdata()`. This means we can remove the `wp_get_current_user` call from `is_super_admin()` while still retaining the same behavior.
Props chrisvanpatten, peterwilsoncc.
Fixes#53386.
Built from https://develop.svn.wordpress.org/trunk@52157
git-svn-id: http://core.svn.wordpress.org/trunk@51749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Due to the way that the `blockquote` and `iframe` are being parsed with a regular expression in `wp_filter_oembed_result()`, if there is any content at all before the `blockquote` start tag then it will fail to be included in the first matching group. By appending the `wp-embed` script instead of prepending it in `get_post_embed_html()`, then the parsing issue is avoided.
Also use non-greedy match `wp_maybe_enqueue_oembed_host_js()`.
Amends [52132].
Fixes#44632.
Built from https://develop.svn.wordpress.org/trunk@52153
git-svn-id: http://core.svn.wordpress.org/trunk@51745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, with absolute positioning, the star character to signify required comment form fields could overlap the text in some languages. The star's styling was also inconsistent between the input labels and the comment notes paragraph.
This commit makes the star's styling more consistent and ensures it does not overlap with the text.
Follow-up to [52029].
Props sabernhardt, hellofromTonya.
Fixes#54408.
Built from https://develop.svn.wordpress.org/trunk@52152
git-svn-id: http://core.svn.wordpress.org/trunk@51744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Refactors the mock logic to a helper function for reuse in multiple tests.
* Mocks the remote request in `WP_REST_Block_Directory_Controller_Test:: test_get_items_no_results()` using the mock helper.
Follow-up to [48242], [52137].
Props hellofromTonya, sergeybiryukov.
See #54420.
Built from https://develop.svn.wordpress.org/trunk@52146
git-svn-id: http://core.svn.wordpress.org/trunk@51738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Copies Navigation Area infrastrucutre from lib/navigation.php in Gutenberg. This
allows a Navigation block to be associated with a particular area which persists
when switching theme.
Props antonvlasenko, mamaduka, spacedmonkey.
See #54337.
Built from https://develop.svn.wordpress.org/trunk@52145
git-svn-id: http://core.svn.wordpress.org/trunk@51737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If `SCRIPT_NAME'` does not exist (which can happen in cron jobs), the following happens:
* PHP 8.1+:
* `Warning: Undefined array key "SCRIPT_NAME"`
* `Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated`
* PHP 8.0: `Warning: Undefined array key "SCRIPT_NAME"`
* PHP 5.6-7.4: No warning or notice
This commit checks if the key exists before passing it to `strpos()`. This resolves the warning, notice, and future error.
Follow-up to [3034], [3069], [12732].
Props audrasjb, costdev, hellofromTonya, karpstrucking, mcjambi, sergeybiryukov.
Fixes#54142.
Built from https://develop.svn.wordpress.org/trunk@52144
git-svn-id: http://core.svn.wordpress.org/trunk@51736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
By default, the theme centers images on the front end when no alignment is selected. In the editor, however, images were aligned to the left side of the block.
This commit ensures that the alignment in the editor matches the one on the front end.
Props sabernhardt, ashfame, poena, annezazu.
Fixes#53809.
Built from https://develop.svn.wordpress.org/trunk@52142
git-svn-id: http://core.svn.wordpress.org/trunk@51734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When posts are edited in bulk, the `_edit_last` meta was not updated for each post. This change adds a call to update the `_edit_last` meta to the current user ID for each post the is updated.
Props calebwoodbridge, peterwilsoncc, guillaumeturpin, audrasjb.
Fixes#42446.
Built from https://develop.svn.wordpress.org/trunk@52141
git-svn-id: http://core.svn.wordpress.org/trunk@51733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `add_{$meta_type}_meta`, `added_{$meta_type}_meta`, `update_{$meta_type}_meta`, `updated_{$meta_type}_meta`, `delete_{$meta_type}_meta`, and `deleted_{$meta_type}_meta` hooks, the `$_meta_value` parameter was documented as "Serialized if non-scalar". However, `$_meta_value` is a copy of the raw meta value before `maybe_serialize` is run and is not serialized. This change updates each of the above hooks' docblocks to remove "Serialized if non-scalar" from the `$_meta_value` parameter description.
Props pputzer, hasanuzzamanshamim.
Fixes#53102.
Built from https://develop.svn.wordpress.org/trunk@52140
git-svn-id: http://core.svn.wordpress.org/trunk@51732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Instead of hitting the live API, this commit mocks the remote request when testing creating an item that's an unknown plugin.
Follow-up to [48242].
Props hellofromTonya, noisysocks, sergeybiryukov, TimothyBlynJacobs.
See #54420.
Built from https://develop.svn.wordpress.org/trunk@52138
git-svn-id: http://core.svn.wordpress.org/trunk@51730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When `m` query_tag has a valid year, i.e. `?m=2021`, and there are posts for that year, `substr()` returns a `false` on PHP 5.6 and an empty string on PHP 7.0+. Passing either of those values to `$wp_locale->get_month()` results in a PHP notice on PHP 5.6 to PHP 7.4 and a PHP Warning on PHP 8.0+.
Why? The `$month` lookup table has zeroized keys from '01' to '12'. A empty value is passed to `zeroise()` returns `'00'` which is directly passed as a key in the month property. That key does not exist.
While `$wp_locale->get_month()` would benefit from guarding/validation, this fix ensures a falsey value is not passed as a month.
Tests are added including a test that fails with this fix not applied.
Follow-up to [801], [35294], [35624].
Props antpb, audrasjb, costdev, davidmosterd, drewapicture, herregroen, hellofromTonya, michelwppi, sergeybiryukov.
Fixes#31521.
Built from https://develop.svn.wordpress.org/trunk@52136
git-svn-id: http://core.svn.wordpress.org/trunk@51728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update packages to include these bug fixes from Gutenberg:
- Group - Fix inner container regexes using fixed div tag
- Image block: Make sure the Image block border radius is inherited if the image is linked
- Navigation: Small fixes
- FSE: Add template_type guards
- Template Part Block: Add some guards
- Fix getEntityRecords to ensure resolution on REST API failure
- Ensure menus before map operation in Nav block
- Link editing: Account for link anchor no longer being present when generating unique link instance key
- Navigation: Hide post attributes meta box
- Fix failing tests and compatibility with 5.9.
- Fix missing <MainDashboardButton> slot fill in site editor
- Move WP_REST_Block_Navigation_Areas_Controller from Gutenberg to Core.
- Fix site editor reset styles in WP 5.9
See #54337.
Built from https://develop.svn.wordpress.org/trunk@52135
git-svn-id: http://core.svn.wordpress.org/trunk@51727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Prevent loading `wp-embed` script unconditionally on every page in favor of conditionally enqueueing when a post embed is detected. The `wp-embed` script is also explicitly marked as being in the footer group. Sites which currently disable post embed scripts from being enqueued via `remove_action( 'wp_head', 'wp_oembed_add_host_js' )` will continue to do so.
* Send a `ready` message from the host page to each post embed window in case the `iframe` loads before the `wp-embed` script does. When the `ready` message is received by the post embed window, it sends the same `height` message as it sends when it loads.
* Eliminate use of `grunt-include` to inject emoji script and the post embed script. Instead obtain the script contents via `file_get_contents()` (as is done elsewhere in core) and utilize `wp_print_inline_script_tag()`/`wp_get_inline_script_tag()` to construct out the script. This simplifies the logic and allows the running of src without `SCRIPT_DEBUG` enabled.
* For the embed code that users are provided to copy for embedding outside of WP, add the `secret` on the `blockquote` and `iframe`. This ensures the `blockquote` will be hidden when the `iframe` loads. The embed code in question is accessed here via `get_post_embed_html()`.
Props westonruter, swissspidy, pento, flixos90, ocean90.
Fixes#44632, #44306.
Built from https://develop.svn.wordpress.org/trunk@52132
git-svn-id: http://core.svn.wordpress.org/trunk@51724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `get_terms` filter currently documents that the filter passes an array as both the first and second parameters, which is normally true, except that the second can be `null` when not specified. This change updates the filter's docblock to indicate that the second parameter can also be of a `null` type.
Props dd32, audrasjb, mukesh27.
Fixes#54222.
Built from https://develop.svn.wordpress.org/trunk@52131
git-svn-id: http://core.svn.wordpress.org/trunk@51723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update packages to include these bug fixes from Gutenberg:
- Force remount LinkControl when moving between links within same richtext block
- Site Editor: Change ToolsMoreMenuGroup slot-fill name
- Respect fields param for global styles REST API requests.
- Try ensuring the item after post content clears floats
- Fix submenus not opening on click
- Apply i18n functions to Nav block menu drops when selecting existing Menu
- Gallery: Make sure the mobile warning notice only runs when images are added to a new block
- Prepare navigation php code for core patch
- Address deprecation issues from Buttons flex layout PR.
- Block Library: Fix incorrect attributes definitions
- Fix Navigation accessibility issues
See #54337.
Built from https://develop.svn.wordpress.org/trunk@52103
git-svn-id: http://core.svn.wordpress.org/trunk@51695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Twenty Twenty-One contained a filter on `the_title` to change the default post title to “Untitled”.
Whenever possible, the default behavior of Core without theme modifications should be confirmed in tests. The default behavior here is for a post title to be “(no title)” when one is not entered.
This change also makes an adjustment to be more specific when retrieving the text to verify results to prevent dates and post statuses from being pulled in.
Props davidbaumwald, desrosj, peterwilsoncc, hellofromTonya.
Fixes#54409.
Built from https://develop.svn.wordpress.org/trunk@52096
git-svn-id: http://core.svn.wordpress.org/trunk@51688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
There's now a way to get a link to a given post's revisions. Introducing `wp_get_post_revisions_url()` and its unit tests.
Props adamsilverstein, audrasjb, costdev, davidbaumwald, garrett-eclipse, georgestephanis, hellofromTonya, iaaxpage.
Fixes#39062.
Built from https://develop.svn.wordpress.org/trunk@52095
git-svn-id: http://core.svn.wordpress.org/trunk@51687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add additional label options to `register_taxonomy()` to allow developers further flexibility for customizing the edit taxonomy screen.
Props mclaurent, swissspidy, johnbillion, jeremyescott, theMikeD, jeremyfelt, dontgo2sleep, SergeyBiryukov, audrasjb, Boniu91.
Fixes#43060.
Built from https://develop.svn.wordpress.org/trunk@52094
git-svn-id: http://core.svn.wordpress.org/trunk@51686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Disable auto-correct for the slug field on the quick/bulk edit interface. As slugs may consist of a number of words combined in to a single string, they are unlikely to pass spell checkers.
Props swb1192, SergeyBiryukov, afragen, Clorith, desrosj, JeffPaul, sabernhardt, Boniu91, costdev, hellofromTonya.
Fixes#50499.
Built from https://develop.svn.wordpress.org/trunk@52092
git-svn-id: http://core.svn.wordpress.org/trunk@51684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On user registration, the `$errors` variable is the result of `register_new_user` which contains either the newly registered user's ID on success or a `WP_Error` object on failure. This change passes that context to the `registration_redirect` filter.
Props Collizo4sky, aadilali, mukesh27, audrasjb.
Fixes#53992.
Built from https://develop.svn.wordpress.org/trunk@52091
git-svn-id: http://core.svn.wordpress.org/trunk@51683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Clarify messaging of when `wp_nonce_ays('log-out')` is called due to an invalid log out nonce. The HTML title now describes the action being taken rather than using the generic text "something went wrong".
Props davidkryzaniak, hellofromTonya, peterwilsoncc.
Fixes#52600.
Built from https://develop.svn.wordpress.org/trunk@52088
git-svn-id: http://core.svn.wordpress.org/trunk@51680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of November 2021, the `HTTP/3` protocol is still officially an Internet Draft, but is already supported by 74% of running web browsers and, according to W3Techs, 23% of the top 10 million websites. It has been supported by Google Chrome (including Chrome for Android, and Microsoft Edge, which is based on it) since April 2020 and by Mozilla Firefox since May 2021. Safari 14 (on macOS Big Sur and iOS 14) has also implemented the protocol but support is hidden behind a feature flag.
Based on the wide support, this change adds `HTTP/3` as a valid HTTP protocol.
Props malthert.
Fixes#54404.
Built from https://develop.svn.wordpress.org/trunk@52087
git-svn-id: http://core.svn.wordpress.org/trunk@51679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds an `is_array()` check before the `in_array()`. Why? `in_array()` requires a array for the haystack. Any other data type will cause a fatal error on PHP 8.0 or higher:
{{{
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array
}}}
As this is a new filter, this type check properly guards to avoid the fatal error.
Follow-up to [52084].
See #54331.
Built from https://develop.svn.wordpress.org/trunk@52085
git-svn-id: http://core.svn.wordpress.org/trunk@51677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a new filter `'http_allowed_safe_ports'` to control which ports are allowed for remote requests. By default, ports 80, 443, and 8080 are allowed for safe remote requests.
Adds tests.
Follow-up to [24480].
Props xknown, johnbillion, jorbin, costdev, dd32.
Fixes#54331.
Built from https://develop.svn.wordpress.org/trunk@52084
git-svn-id: http://core.svn.wordpress.org/trunk@51676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a new `wp_mail_succeeded` action in `wp_mail` after the mail is sent. Also, adds a disclaimer to the hook's docblock, clarifying that the hook's firing doesn't necessarily mean the recipient received the mail, only that the mail was processed without any errors.
Props birgire, donmhico, johnbillion.
Fixes#53826.
Built from https://develop.svn.wordpress.org/trunk@52083
git-svn-id: http://core.svn.wordpress.org/trunk@51675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If a privacy policy is set, the page links to the footer of the site. As done in the other bundled themes, this link is added using `the_privacy_policy_link()`.
Follow-up to [49216].
Props ryelle, desrosj, kapilpaul, sabernhardt, audrasjb, justinahinon.
Fixes#53445.
Built from https://develop.svn.wordpress.org/trunk@52082
git-svn-id: http://core.svn.wordpress.org/trunk@51674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Twenty Twenty-Two arrives during an exciting time for WordPress themes. With the advent of Full Site Editing and Global Styles, themes are changing structurally and functionally to enable far more avenues for customization than users have come to expect in the past.
To take advantage of these new abilities, Twenty Twenty-Two has been designed to be the most flexible default theme ever created for WordPress.
Props sourav926, aristath, audrasjb, bgardner, briceduclos, poena, colorful-tones, dgwyer, dimadin, gregrickaby, ellenbauer, jffng, kafleg, karmatosed, kraftbj, kjellr, littlebigthing, onemaggie, matveb, mburridge, mtoensing, nickcernis, nielslange, williampatton, pgking, ribaricplusplus, scruffian, soean, utz119, youknowriad, desrosj, richtabor.
See #54318.
Built from https://develop.svn.wordpress.org/trunk@52081
git-svn-id: http://core.svn.wordpress.org/trunk@51673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit introduces the `/wp/v2/menus`, `/wp/v2/menu-items` and `/wp/v2/menu-locations` REST API endpoints. These endpoints are fully available to users with the `edit_theme_options` capability, but can be read by any user who can edit a REST API available post type.
The `nav_menu` taxonomy and `nav_menu_item` post type now map their capabilities to the `edit_theme_options` primitive capability. This allows developers to provide more fine-grained access control. However, if a developer is currently dynamically removing the `edit_theme_options` capability using `map_meta_cap`, they should use the `user_has_cap` filter instead.
The `wp_update_nav_menu_item()` function has been adjusted to return an error if saving the menu item post or assigning the menu item to a menu generate an error.
Lastly, a new menu item type is introduced, `block`, that can be used to store a Block as a menu item.
Props andraganescu, antonvlasenko, dingo_d, dlh, isabel_brison, kadamwhite, Mamaduka, NateWr, noisysocks, peterwilsoncc, ryelle, schlessera, soean, Spacedmonkey, talldanwp, TimothyBlynJacobs, tobifjellner, westonruter, wpscholar, zieladam.
Fixes#40878.
Built from https://develop.svn.wordpress.org/trunk@52079
git-svn-id: http://core.svn.wordpress.org/trunk@51671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This removes the use of `get_theme_file_path()` within `WP_Theme_JSON_Resolver` in favor of the similar `get_file_path_from_theme()` method.
The former is found within `wp-includes/link-template.php`, which is not currently loaded when `load-styles.php` attempts to load the necessary styles. `self::get_file_path_from_theme()` was used previously, but this was changed in [52049].
Props Mamaduka, audrasjb, hellofromTonya, jorbin, desrosj.
Fixes#54401. See #54336.
Built from https://develop.svn.wordpress.org/trunk@52077
git-svn-id: http://core.svn.wordpress.org/trunk@51669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds the `wp_login_url()` login link to the Error message to be more helpful to users when their user email already is registered.
Improves the error message to more clearly communicate next step.
Follow-up to [16009], [22124], [31963].
Props andynick, costdev, dansoschin, sabernhardt, webcommsat.
Fixes#53631.
Built from https://develop.svn.wordpress.org/trunk@52074
git-svn-id: http://core.svn.wordpress.org/trunk@51666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- First pass at adding the site editor from the Gutenberg plugin to
wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.
Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.
Built from https://develop.svn.wordpress.org/trunk@52069
git-svn-id: http://core.svn.wordpress.org/trunk@51661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The code in `wp_list_filter()` was a duplicate of `wp_filter_object_list()`, minus the `WP_List_Util::pluck()` (used when `$field` is configured).
In testing the wrapper, discovered an edge case (and potential bug) in `WP_List_Util::filter()` where if the operator matches an empty array was returned without resetting the output property. Without that property being set correctly, `WP_List_Util::get_output()` was not correct. This commit also fixes this by resetting the property to an empty array.
Follow-up to [15686], [17427], [38928], [51044].
Props pbearne, sergeybiryukov, hellofromTonya.
Fixes#53988.
Built from https://develop.svn.wordpress.org/trunk@52066
git-svn-id: http://core.svn.wordpress.org/trunk@51658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset implements the refined lazy-loading behavior outlined in https://make.wordpress.org/core/2021/07/15/refining-wordpress-cores-lazy-loading-implementation/ in order to improve the Largest Contentful Paint metric, which can see a regression from images or iframes above the fold being lazy-loaded. Adjusting this so far has been possible for developers via filters and still is, however this enhancement brings a more accurate behavior out of the box for the majority of themes.
Specifically, this changeset skips the very first "content image or iframe" on the page from being lazy-loaded. "Content image or iframe" denotes any image or iframe that is found within content of any post in the current main query loop as well as any featured image of such a post. This applies both to "singular" as well as "archive" content: On a "singular" page the first image/iframe of the post is not lazy-loaded, while on an "archive" page the first image/iframe of the _first_ post in the query is not lazy-loaded.
This approach refines the lazy-loading behavior correctly for the majority of themes, which use a single-column layout for post content. For themes with multi-column layouts, a new `wp_omit_loading_attr_threshold` filter can be used to change how many of the first images/iframes are being skipped from lazy-loaded (default is `1`). For example, a theme using a three-column grid of latest posts for archives could use the filter to override the threshold to `3` on archive pages, so that the first three content images/iframes would not be lazy-loaded.
Props adamsilverstein, azaozz, flixos90, hellofromtonya, jonoaldersonwp, mte90, rviscomi, tweetythierry, westonruter.
Fixes#53675. See #50425.
Built from https://develop.svn.wordpress.org/trunk@52065
git-svn-id: http://core.svn.wordpress.org/trunk@51657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces a new function called `wp_list_users()`. Similar to other list functions such as `wp_list_authors()`, it lists all the users of the site. Options are available to configure the HTML output.
Following the same pattern of the other list functions, the list's HTML output is rendered by default. Setting the `echo` argument to `false`, returns the list's HTML output.
A new test class is included.
Props afercia, audrasjb, chriscct7, costdev, desrosj, greenshady, hellofromTonya, mte90, nacin, rohan013, sergeybiryukov.
Fixes#15145.
Built from https://develop.svn.wordpress.org/trunk@52064
git-svn-id: http://core.svn.wordpress.org/trunk@51656 1a063a9b-81f0-0310-95a4-ce76da25c4cd