Commit Graph

34545 Commits

Author SHA1 Message Date
Sergey Biryukov
2f87b14d11 Tests: Make sure the correct query is tested for term limits in taxonomy queries.
By hooking into `terms_pre_query` after the fixture posts and terms are created but before the actual taxonomy query runs, we ensure that the correct SQL query from `WP_Term_Query::get_terms()` is tested for requested term limits, rather than the one initiated from `wp_insert_post()` or `wp_insert_term()` via `term_exists()`.

Follow-up to [52921], [53037].

Props david.binda.
Fixes #57342.
Built from https://develop.svn.wordpress.org/trunk@55460


git-svn-id: http://core.svn.wordpress.org/trunk@54993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-04 11:52:22 +00:00
Joe McGill
53fcd4bacb Build/Test Tools: Add a performance measurement workflow.
This adds a new GitHub Action workflow that measures a set of performance metrics on every commit, so we can track changes in the performance of WordPress over time and more easily identify changes that are responsible for significant performance improvements or regressions during development cycles.

The workflow measures the homepage of a classic theme (Twenty Twenty-One) and a block theme (Twenty Twenty-Three) set up with demo content from the Theme Test Data project. Using the e2e testing framework, it makes 20 requests and records the median value of the following Server Timing metrics, generated by an mu-plugin installed as part of this workflow:

- Total server response time
- Server time before templates are loaded
- Server time during template rendering

In addition to measuring the performance metrics of the current commit, it also records performance metrics of a consistent version of WordPress (6.1.1) to be used as a baseline measurement in order to remove variance caused by the GitHub workers themselves from our reporting.

The measurements are collected and displayed at https://www.codevitals.run/project/wordpress.

Props adamsilverstein, mukesh27, flixos90, youknowriad, oandregal, desrosj, costdev, swissspidy.
Fixes #57687.

Built from https://develop.svn.wordpress.org/trunk@55459


git-svn-id: http://core.svn.wordpress.org/trunk@54992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-03 20:39:20 +00:00
desrosj
ac2395acf1 Twenty Nineteen: Update PostCSS to version 8.x.
This updates the build processes within Twenty Nineteen to use the latest major version of PostCSS, 8.x.

There are no changes to any built files as a result of these updates.

Props desrosj, peterwilsoncc.
Fixes #57554.
Built from https://develop.svn.wordpress.org/trunk@55458


git-svn-id: http://core.svn.wordpress.org/trunk@54991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-03 20:22:23 +00:00
Sergey Biryukov
92741eba57 Tests: Second pass at merging file-level and class-level DocBlocks in various unit test files.
Per the[https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#6-file-headers documentation standards], whenever possible, all WordPress files should contain a header DocBlock, regardless of the file’s contents – this includes files containing classes.

However, this recommendation makes less sense for unit test classes if not applied consistently, and the duplicate tags cause some confusion.

This commit aims to reduce confusion and avoid repeating information by combining the DocBlocks.

Follow-up to [55337].

Props sakibmd, fuadragib, robinwpdeveloper, naeemhaque, seakashdiu, jakariaistauk, hasanmisbah, SergeyBiryukov.
Fixes #57723.
Built from https://develop.svn.wordpress.org/trunk@55457


git-svn-id: http://core.svn.wordpress.org/trunk@54990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-03 14:44:22 +00:00
hellofromTonya
2d2f24f6f8 Build/Test Tools: Add wp_check_filetype() unit tests.
Adds a test class and data set for unit testing `wp_check_filetype()`.

Props pbearne, costdev.
Fixes #57151.
Built from https://develop.svn.wordpress.org/trunk@55456


git-svn-id: http://core.svn.wordpress.org/trunk@54989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-02 21:05:22 +00:00
Sergey Biryukov
06305406df Docs: Fix typo in wp_generate_password() description.
Follow-up to [42373].

Props pyrobd, pravinparmar2404, mukesh27.
Fixes #57847.
Built from https://develop.svn.wordpress.org/trunk@55455


git-svn-id: http://core.svn.wordpress.org/trunk@54988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-02 13:57:23 +00:00
Sergey Biryukov
c7f946d961 Post WordPress 6.2 Beta 4 version bump.
Built from https://develop.svn.wordpress.org/trunk@55454


git-svn-id: http://core.svn.wordpress.org/trunk@54987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 17:39:17 +00:00
Sergey Biryukov
1790e02848 WordPress 6.2 Beta 4.
Built from https://develop.svn.wordpress.org/trunk@55453


git-svn-id: http://core.svn.wordpress.org/trunk@54986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 17:19:20 +00:00
Sergey Biryukov
932449e9fa Help/About: Improve help text about the WordPress URL and Site URL settings.
This aims to elaborate a bit more on the difference between these two settings, as well as explain the `http://` or `https://` prefix.

Follow-up to [15000], [19472].

Props marybaum, sabernhardt, tobifjellner, justinahinon, webcommsat, hellofromtonya, audrasjb, robinwpdeveloper, costdev, SergeyBiryukov.
Fixes #50886.
Built from https://develop.svn.wordpress.org/trunk@55452


git-svn-id: http://core.svn.wordpress.org/trunk@54985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 17:03:19 +00:00
ryelle
774a23c3c0 Administration: Update the Dashboard welcome banner for 6.2.
Props richtabor, markoserb, laurlittle.
See #57759.


Built from https://develop.svn.wordpress.org/trunk@55451


git-svn-id: http://core.svn.wordpress.org/trunk@54984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:42:18 +00:00
audrasjb
3fdc61552e Media: Rename the wp_ajax_save_attachment action hook to wp_ajax_save_attachment_updated.
This changeset renames the `wp_ajax_save_attachment` action to `wp_ajax_save_attachment_updated` to avoid confusion with the similarly named `wp_ajax_save-attachment` action. This also add a dockblock note to indicate that when checking if an action is being done, `doing_action( 'wp_ajax_save-attachment' )` may be used if that is more convenient.

Follow-up to [55106].

Props azaozz, sc0ttkclark, costdev.
Fixes #23148

Built from https://develop.svn.wordpress.org/trunk@55450


git-svn-id: http://core.svn.wordpress.org/trunk@54983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:32:20 +00:00
ryelle
7a4b3a5dab Help/About: Update the About page for 6.2.
This is the start of the WordPress 6.2 about page, introducing new content and a first pass of the new style.

Props laurlittle, jpantani, richtabor, audrasjb.
See #57477.


Built from https://develop.svn.wordpress.org/trunk@55449


git-svn-id: http://core.svn.wordpress.org/trunk@54982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:30:20 +00:00
audrasjb
0b2a7b380f Editor: Ensure Global styles values are reset in the site editor.
This changeset fixes a bug by which the reset function of the global styles sidebar would not work as expected in the site editor. It reverts [54517] and adds related unit tests.

Props oandregal, ntsekouras, youknowriad, hellofromTonya.
Fixes #57824
See #56467

Built from https://develop.svn.wordpress.org/trunk@55448


git-svn-id: http://core.svn.wordpress.org/trunk@54981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:17:18 +00:00
hellofromTonya
47c492b114 Editor: Exclude non-sticky posts in Query Loop Block when set to "Only".
Fixes a front-end issue to not include non-sticky posts in the Query Loop block when it's "Sticky Post" is set to "Only", meaning only show sticky posts.

This change was made in Gutenberg between 5.8 to 6.0, but was not merged into Core.

Reference:
* [42dad571ea/lib/compat/wordpress-6.1/blocks.php (L171-L183) Gutenberg code]

Follow-up to [50945].

Props RavanH, sc0ttkclark, ocean90, sc0ttkclark, hellofromTonya, ntsekouras.
Fixes #57822.
Built from https://develop.svn.wordpress.org/trunk@55447


git-svn-id: http://core.svn.wordpress.org/trunk@54980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:15:18 +00:00
audrasjb
c4593442cd Script Loader: Pass the asset path to the _doing_it_wrong() notice in register_block_script_handle().
This changeset ensures the file path is correctly passed in the output from `_doing_it_wrong()` notice in `register_block_script_handle()`.

Props desrosj, neychok, mahbubshovan, ironprogrammer, robinwpdeveloper, hellofromTonya, simongomes02, mukesh27, costdev.
Fixes #53566.

Built from https://develop.svn.wordpress.org/trunk@55446


git-svn-id: http://core.svn.wordpress.org/trunk@54979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 15:59:41 +00:00
Sergey Biryukov
0c81b800a4 Tests: Ignore EOL differences in a wpautop() test for <math> block elements.
Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

This commit resolves a failure when running the test suite on Windows:
{{{
1) Tests_Formatting_wpAutop::test_skip_block_math_elements
Failed asserting that two strings are identical.
...
#Warning: Strings contain different line endings!
}}}

Follow-up to [55272].

Props davidbaumwald, ignatggeorgiev, sakibmd.
Fixes #57718.
Built from https://develop.svn.wordpress.org/trunk@55445


git-svn-id: http://core.svn.wordpress.org/trunk@54978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 15:58:24 +00:00
Sergey Biryukov
376748a097 Users: Use a separate variable for the post counts query in wp_list_authors().
This avoids a collision if `wp_list_authors()` is called with the `optioncount` parameter enabled, and the resulting array for the post counts query contains a key that matches the ID of a user who does not have any posts.

Follow-up to [54262].

Props peterwilsoncc, johnbillion, lifeboat, brookedot, thedaysse, Toru.
Fixes #57011.
Built from https://develop.svn.wordpress.org/trunk@55444


git-svn-id: http://core.svn.wordpress.org/trunk@54977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 15:39:27 +00:00
hellofromTonya
13195cfe8e Editor: Partial revert of r55230.
[55230] introduced a regression to the content markup. This changeset is a partial revert to remove the added `wp-includes/block-supports/anchor.php` file. 

The change of adding `'id'` to `$attributes_to_merge` in `get_block_wrapper_attributes()` is not reverted as this change did not impact the regression and helps to support continue development in Gutenberg for the anchor support in dynamic blocks feature.

Reference:
* [https://github.com/WordPress/gutenberg/pull/48592 Gutenberg PR 48592].

Follow-up [55230].

Props wildworks, mamaduka, hellofromTonya. 
Fixes #57830.
See #56852.
Built from https://develop.svn.wordpress.org/trunk@55443


git-svn-id: http://core.svn.wordpress.org/trunk@54976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 15:05:19 +00:00
Sergey Biryukov
f57f704bbb Tests: Add unit tests for get_next_posts_link() and get_previous_posts_link().
The tests ensure that the `next_posts_link_attributes` and `previous_posts_link_attributes` filters are applied correctly.

Follow-up to [1383], [5045], [8502], [9632], [55429].

Props geisthanen, mukesh27, costdev, audrasjb, SergeyBiryukov.
Fixes #55751.
Built from https://develop.svn.wordpress.org/trunk@55442


git-svn-id: http://core.svn.wordpress.org/trunk@54975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 14:45:20 +00:00
gziolo
27d51752d5 Build: Regenerate correctly the block-json.php file
See #57471.
Follow-up [55440].


Built from https://develop.svn.wordpress.org/trunk@55441


git-svn-id: http://core.svn.wordpress.org/trunk@54974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 12:20:17 +00:00
gziolo
d444b56849 Update the WP packages with fixes prior to WP 6.2 beta 4
This updated the packages to the latest versions with the latest fixes.

Gutenberg changes: 35f10c1836

Includes the following bug fixes:

- Only add layout classes to inner wrapper if block is a container.
- Revert dynamic block anchor support
- [Inserter - Media tab]: Upload Openverse images when inserted
- SpacingSizesControl: Fix white dot on thumb
- Site Editor: update the edit button
- Change "Browse all templates" to "Manage all templates" in template details popover
- Remove TemplateAreas from template details
- Add support for orientation-based block movers to core/social-links
- Site Editor: polish add template modal style
- Match color of the focus template view with site dark material
- Site Editor: Fix routing for Classic themes using block-based template parts
- Remove broken site editor redirect
- Make the template customized info accessible
- Sort templates and template parts by slug
- Prevent distracting focused back button on site editor load
- Fix: Content only CPT template locking.
- Pin floating-ui/react-dom version
- Widget Importer: Don't render controls when there's nothing to import
- Post Editor: Update postContentBlock check to see if the block is valid
- Site Tagline: Add example so that it will display in style book
- Remove copy for managing a block's style variations
- Fix the site editor home page loading when installed in a subdirectory
- Global Styles: Display preset names via the tooltip
- [Query Loop] Fix top border in pattern selection modal
- Site Editor: Fix the 'Browse all' link in the template details modal
- Site Editor: Fix the tooltip and shortcut for the global save button
- Make the Site Logo block placeholder state smaller
- Site Editor Sidebar: Add line-height for template/parts name and update width for edit button
- Style Book: Focus the Style Book when opened, and enable ESCAPE key to close
- [Site Editor]: Set html block as freeform fallback block
- Make the performance tests more stable
- Adds all allowed innerblocks to the inspector animation experiment
- Revert Link control UX changes for WP 6.2
- Fix Site Editor perf tests
- Playwright: fix request utils for non Docker envs

See #57471.
Props Mamaduka, ntsekouras.


Built from https://develop.svn.wordpress.org/trunk@55440


git-svn-id: http://core.svn.wordpress.org/trunk@54973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 12:05:03 +00:00
gziolo
b68b0ad84d Editor: Only add layout classes to inner wrapper if block is a container
Backport of https://github.com/WordPress/gutenberg/issues/48606, which fixes an issue found in adding fixtures for deprecated Gallery block versions in #55571.

See #55571.
Fixes #57831.
Props isabel_brison, Mamaduka, dasnitesh780.



Built from https://develop.svn.wordpress.org/trunk@55439


git-svn-id: http://core.svn.wordpress.org/trunk@54972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 11:47:19 +00:00
gziolo
12995d49e4 Editor: Correctly merge custom CSS into global styles
Update the get_block_editor_settings function and merge custom CSS directly into the $global_styles array.

Fixes #57833.
Props Mamaduka, poena, sakibmd.


Built from https://develop.svn.wordpress.org/trunk@55438


git-svn-id: http://core.svn.wordpress.org/trunk@54971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 11:43:20 +00:00
Andrew Ozz
e9d290a104 Media: Revert the addition of a $size parameter to get_attached_file().
Reverts [55199], [55202], and [55217] but keeps the updated docs.

Props: flixos90, joedolson, azaozz.
Fixes: #51780.
Built from https://develop.svn.wordpress.org/trunk@55437


git-svn-id: http://core.svn.wordpress.org/trunk@54970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 00:36:24 +00:00
hellofromTonya
5d05653b2f Editor: Deprecate _resolve_home_block_template().
The internal Core-only `_resolve_home_block_template()` function was introduced in [53093] for a specific purpose of resolving the template for a site's home page. It was used as part of the Site Editor's redirect when the `postType` and `postId` query args were missing. The server-side handling was removed in [55338]. The function is no longer used in Core.

This changeset deprecates the function and removes its tests.

Follow-up to [55338], [53093].

Props johnbillion, hellofromTonya.
Fixes #57716.
Built from https://develop.svn.wordpress.org/trunk@55436


git-svn-id: http://core.svn.wordpress.org/trunk@54969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 15:07:23 +00:00
hellofromTonya
278725acba Site Editor: Add 'path' query arg to Appearance > Template Parts menu.
To display a list of block-based template parts for classic themes, this changeset adds a `path` query arg to the Appearance > Template Parts menu URL. This change is necessary due to recent changes to Site Editor's client-side routing.

Reference:
* [https://github.com/WordPress/gutenberg/pull/48343 Gutenberg PR 48343]
* [https://github.com/WordPress/gutenberg/pull/42729 Gutenberg PR 42729]

Follow-up to [55392], [54176].

Props mamaduka, audrasjb, fabiankaegy, hellofromTonya, kevin940726, mukesh27, youknowriad.
Fixes #57819.
Built from https://develop.svn.wordpress.org/trunk@55435


git-svn-id: http://core.svn.wordpress.org/trunk@54968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 15:04:23 +00:00
Sergey Biryukov
f6b1fd3205 Help/About: Restore the correct URL for Editing Files article on Edit Themes screen.
Replace the URL for Editing Themes article instead to avoid an extra redirect.

Follow-up to [55432].

See #57726.
Built from https://develop.svn.wordpress.org/trunk@55434


git-svn-id: http://core.svn.wordpress.org/trunk@54967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 13:52:20 +00:00
Sergey Biryukov
0449c238bd Users: Adjust the initialization of the $duplicated_keys array in wp_salt().
This avoids an endless loop if `get_current_user_id()` is used in a callback attached to the `gettext` filter.

With the translated phrase moved into a separate assignment, the function succeeds in setting the static `$duplicated_keys` array once and no longer goes into this code section on subsequent calls.

Follow-up to [54249].

Props adityaarora010196, SergeyBiryukov.
Fixes #57121.
Built from https://develop.svn.wordpress.org/trunk@55433


git-svn-id: http://core.svn.wordpress.org/trunk@54966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 13:22:22 +00:00
audrasjb
933bb3999b Help/About: Avoid extra redirections on HelpHub Links.
This changeset replaces various HelpHub links that have changed to avoid extra 301 redirections.

Follow-up to [55412], [55413], [55414], [55415], [55416], [55431].

Props sabernhardt, audrasjb.
Fixes #57726.

Built from https://develop.svn.wordpress.org/trunk@55432


git-svn-id: http://core.svn.wordpress.org/trunk@54965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 12:52:18 +00:00
audrasjb
7939ee8926 Help/About: Use a consistent capitalization for "Support forums" links across WP Admin.
This partially reverts [55415] and fix a few inconsistencies found in "support forums" links.

Follow-up to [55412], [55413], [55415].

Props sabernhardt, audrasjb.
See #57726.

Built from https://develop.svn.wordpress.org/trunk@55431


git-svn-id: http://core.svn.wordpress.org/trunk@54964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 12:48:23 +00:00
Peter Wilson
baf4e6021f Formatting: Add aspect-ratio tests for safecss_filter_attr().
Follow up to [55309].

Props rahmohn, desrosj, mukesh27.
Fixes #57664.

Built from https://develop.svn.wordpress.org/trunk@55430


git-svn-id: http://core.svn.wordpress.org/trunk@54963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-28 02:52:20 +00:00
audrasjb
fa42e86adf Build/Test Tools: Add test coverage for the get_posts_navigation() function.
This changeset adds a test case to verify that `get_the_posts_navigation()` only includes the "Older posts" and "Newer" posts links when appropriate.

Props jongycastillo, michelmany, joyously, geisthanen, SergeyBiryukov, mukesh27, audrasjb, costdev, sun, chrisbaltazar.
Fixes #55751.

Built from https://develop.svn.wordpress.org/trunk@55429


git-svn-id: http://core.svn.wordpress.org/trunk@54962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-27 23:16:20 +00:00
audrasjb
5170ad3bac Docs: Fix erroneous @since mention in wp_internal_hosts hook.
Follow-up to [55289].

Props wildworks, SergeyBiryukov, simongomes02.
Fixes #57796.

Built from https://develop.svn.wordpress.org/trunk@55428


git-svn-id: http://core.svn.wordpress.org/trunk@54961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-27 22:55:22 +00:00
Felix Arntz
26ab805ad4 Twenty Twenty: Avoid PHP warnings in 8.1 due to incorrect usage of wp_add_inline_style().
This changeset adjusts the logic to use a more defensive approach, to avoid passing potentially invalid values to `wp_add_inline_style()`.

Props flixos90, mukesh27, costdev, swissspidy, poena, sabernhardt.
Fixes #57777.

Built from https://develop.svn.wordpress.org/trunk@55427


git-svn-id: http://core.svn.wordpress.org/trunk@54960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-27 17:32:18 +00:00
Sergey Biryukov
58d7cd099e Themes: Account for a numeric theme directory in WP_Theme::__construct().
This ensures that if a theme with a numeric directory name is active, it is correctly identified as such, and that theme support features work as expected.

Follow-up to [20029], [49925].

Props lopo, alvastar, winterpsv, hugodevos, ankit-k-gupta, jakariaistauk, mukesh27, spacedmonkey, SergeyBiryukov.
Fixes #54645.
Built from https://develop.svn.wordpress.org/trunk@55426


git-svn-id: http://core.svn.wordpress.org/trunk@54959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-27 15:34:23 +00:00
Sergey Biryukov
04967a68b6 Upgrade/Install: Introduce WP_Automatic_Updater::is_allowed_dir() method.
As part of determining whether to perform automatic updates, WordPress checks if it is running within a version-controlled environment, recursively looking up the filesystem to the top of the drive, looking for a Subversion, Git, Mercurial, or Bazaar directory, erring on the side of detecting a VCS checkout somewhere.

This commit avoids a PHP warning if the `open_basedir` directive is in use and any of the directories checked in the process are not allowed:
{{{
is_dir(): open_basedir restriction in effect. File(/.git) is not within the allowed path(s)
}}}

Follow-up to [25421], [25700], [25764], [25835], [25859].

Props costdev, markjaquith, meyegui, dd32, arnolp, robin-labadie, hellofromTonya, afragen, pbiron, SergeyBiryukov.
Fixes #42619.
Built from https://develop.svn.wordpress.org/trunk@55425


git-svn-id: http://core.svn.wordpress.org/trunk@54958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-26 15:19:21 +00:00
Sergey Biryukov
325a14a3ef Docs: Correct duplicate hook reference for notify_moderator.
The original filter location is `wp_notify_moderator()` in `wp-includes/pluggable.php`.

This commit updates the instance in `wp_new_comment_notify_moderator()` to point to the correct file.

Follow-up to [35339], [35725].

Props zevilz.
Fixes #57808.
Built from https://develop.svn.wordpress.org/trunk@55424


git-svn-id: http://core.svn.wordpress.org/trunk@54957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-25 21:56:21 +00:00
Sergey Biryukov
66937c7dce General: Add more error checking to WP_List_Util::pluck().
Values for the input array in `WP_List_Util::pluck()` or `wp_list_pluck()` must be either objects or arrays.

This commit adds a check to ensure that the value retrieved in the loop is an array before treating it as such, and throws a `_doing_it_wrong()` notice if it is neither an object nor an array.

Follow-up to [14108], [15686], [18602], [28900], [38928].

Props afragen, costdev, audrasjb.
Fixes #56650.
Built from https://develop.svn.wordpress.org/trunk@55423


git-svn-id: http://core.svn.wordpress.org/trunk@54956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-25 10:59:22 +00:00
Sergey Biryukov
5f0e3de1f8 Twenty Seventeen: Mark one more screen reader string with a translator comment.
Includes minor comment layout fixes for consistency with other themes.

Follow-up to [55276].

See #29748.
Built from https://develop.svn.wordpress.org/trunk@55422


git-svn-id: http://core.svn.wordpress.org/trunk@54955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-24 15:26:18 +00:00
Sergey Biryukov
89f39839ab Database: Remove the check for sitecategories table on Database Repair screen.
The table is no longer created by core as of WordPress 3.0, and support for global terms was removed in WordPress 6.1, so `$wpdb->sitecategories` is unset by default.

This commit resolves a "passing null to non-nullable" deprecation notice on PHP 8.1:
{{{
Deprecated: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in wp-includes/class-wpdb.php on line 1804
}}}

The `tables_to_repair` filter is available for plugins to readd the table or include any additional tables to repair.

Follow-up to [14854], [14880], [54240].

Props ipajen, chiragrathod103, SergeyBiryukov.
Fixes #57762.
Built from https://develop.svn.wordpress.org/trunk@55421


git-svn-id: http://core.svn.wordpress.org/trunk@54954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-24 15:10:22 +00:00
Sergey Biryukov
803426a023 Coding Standards: Use strict comparison in bundled themes' PHP files.
This addresses all the remaining WPCS warnings in bundled themes.

Includes using the correct type when checking the number of comments, as `get_comments_number()` returns a numeric string, not an integer.

Follow-up to [41285], [44562], [47941].

Props aristath, poena, afercia, SergeyBiryukov.
See #56791.
Built from https://develop.svn.wordpress.org/trunk@55420


git-svn-id: http://core.svn.wordpress.org/trunk@54953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-24 06:23:23 +00:00
Sergey Biryukov
896f5ef18f Posts, Post Types: Pass the post object to _update_posts_count_on_delete().
The function checks the status of the post being deleted, and then only calls `update_posts_count()` if the deleted post was previously published, as the update query would be unnecessary otherwise.

However, by the time the function runs, the post is already deleted from the database, and the post status check fails.

This commit uses the previously retrieved post object for the status check, so that the function proceeds as expected.

Includes updating the unit test to call `wp_delete_post()` with the `$force_delete` argument, so that the post is actually deleted, not trashed, and the `after_delete_post` action is run.

Follow-up to [28835], [52207], [54760], [54762].

Fixes #57023.
Built from https://develop.svn.wordpress.org/trunk@55419


git-svn-id: http://core.svn.wordpress.org/trunk@54952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-24 01:23:20 +00:00
joedolson
f51b63c1fe Networks and Sites: Use consistent markup for admin notices.
Fix admin notices in network screens so they use consistent markup and style.

Props afercia, marksabbath, stevenkword, jeremyfelt, aryamaaru, robinwpdeveloper, obayedmamur, joedolson.
Fixes #39213.
Built from https://develop.svn.wordpress.org/trunk@55418


git-svn-id: http://core.svn.wordpress.org/trunk@54951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 22:13:23 +00:00
Felix Arntz
259af07d2b Editor: Fix invalid parameters being passed to wp_register_style().
Boolean `true` is not a valid value for the `$ver` or `$media` parameters of `wp_register_style()`.

Props sabernhardt, flixos90, hellofromtonya.
Fixes #57771. See #56990, #57688.

Built from https://develop.svn.wordpress.org/trunk@55417


git-svn-id: http://core.svn.wordpress.org/trunk@54950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 21:34:19 +00:00
Sergey Biryukov
1356f65372 Toolbar: Update the URL for Documentation link in the admin bar.
This avoids an extra redirect from `https://wordpress.org/support/` to `https://wordpress.org/documentation/`.

Follow-up to [55412], [55413], [55414], [55415].

See #57726.
Built from https://develop.svn.wordpress.org/trunk@55416


git-svn-id: http://core.svn.wordpress.org/trunk@54949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 12:34:18 +00:00
audrasjb
54dd6eda90 Help/About: Use a consistent capitalization for "Support forums" links across WP Admin.
Follow-up to [55412], [55413].

See #57726.

Built from https://develop.svn.wordpress.org/trunk@55415


git-svn-id: http://core.svn.wordpress.org/trunk@54948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 11:13:22 +00:00
audrasjb
34229a4286 Help/About: Avoid extra redirections on HelpHub Links.
This changeset replaces various HelpHub links that have changed to avoid extra 301 redirections.

Props sabernhardt, audrasjb.
See #57726.

Built from https://develop.svn.wordpress.org/trunk@55414


git-svn-id: http://core.svn.wordpress.org/trunk@54947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 11:06:19 +00:00
audrasjb
0000d83e08 Help/About: Use the new /documentation/ URLs for HelpHub links in Bundled Themes.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.

Built from https://develop.svn.wordpress.org/trunk@55413


git-svn-id: http://core.svn.wordpress.org/trunk@54946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:49:19 +00:00
audrasjb
418a21fdbc Help/About: Use the new /documentation/ URLs for HelpHub links in WordPress Admin.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.

Built from https://develop.svn.wordpress.org/trunk@55412


git-svn-id: http://core.svn.wordpress.org/trunk@54945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:38:21 +00:00
audrasjb
8771b175cd Mail: Fix character encoding issues in Plugin/Theme background update emails.
This changeset fixes encoding issues in background update emails by applying `html_entity_decode()` on Plugin/Theme names in `send_plugin_theme_email()`.

Props paulschreiber, audrasjb, benjgrolleau, sanketchodavadiya, robinwpdeveloper, paulamit.
Fixes #56964.

Built from https://develop.svn.wordpress.org/trunk@55411


git-svn-id: http://core.svn.wordpress.org/trunk@54944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:07:26 +00:00
audrasjb
e61ec90f68 Administration: Move wp-theme-plugin-editor script before </body>.
This changeset moves the `wp-theme-plugin-editor` admin script before `</body>` instead of in the `<head>`. This fixes an issue where the collapse admin menu feature was not working in the Theme|Plugin File Editor screens.

Props itsnikhilpatel, dilipbheda, stalukder03, audrasjb, adeltahri, Ankit-K-Gupta, mahbubshovan.
Fixes #57073.

Built from https://develop.svn.wordpress.org/trunk@55410


git-svn-id: http://core.svn.wordpress.org/trunk@54943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 23:39:17 +00:00
joedolson
0f98f3142c Widgets: Match variable types in rss feed link filter.
The `rss_widget_feed_link` filter added in [52031] documents the parameter as a string, but recommends removing by returning false. Change the recommendation and documentation to make this consistent and update Twenty Twenty One to use the new recommended return value. Maintains documentation as possibly returning `false` for backwards compatibility.

Props sabernhardt, Mista-Flo.
Fixes #57594.
Built from https://develop.svn.wordpress.org/trunk@55409


git-svn-id: http://core.svn.wordpress.org/trunk@54942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 22:02:23 +00:00
John Blackbourn
9ddb112d51 Networks and Sites: Remove confusing upper case for option names on Edit Site: Settings screen.
This type of transformation isn't always appropriate, especially for non-English language sites. Displaying the original option name makes it more clear what option is being changed.

Props SergeyBiryukov, sabernhardt, afrin29, afshanadiya

Fixes #50572

Built from https://develop.svn.wordpress.org/trunk@55408


git-svn-id: http://core.svn.wordpress.org/trunk@54941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 20:57:18 +00:00
hellofromTonya
1579f32cc6 HTML API: Fix finding bookmarks set on closing tag WP_HTML_Tag_Processor.
Setting a bookmark on a tag should set its "start" position before the opening "<", e.g.:
{{{
<div> Testing a <b>Bookmark</b>
----------------^
}}}

The previous calculation assumed this is always one byte to the left from `$tag_name_starts_at`.

However, in a closing tag that index points to a solidus symbol "/":
{{{
<div> Testing a <b>Bookmark</b>
----------------------------^
}}}

The bookmark should therefore start two bytes before the tag name:
{{{
<div> Testing a <b>Bookmark</b>
---------------------------^
}}}

This changeset achieves this by:
* Using the correct starting index for closing tag bookmarks.
* Adding `array( 'tag_closers' => 'visit' )` in `WP_HTML_Tag_Processor::seek()`.

Follow-up to [55203].

Props zieladam, dmsnell, flixos90.
Fixes #57787.
See #57575.
Built from https://develop.svn.wordpress.org/trunk@55407


git-svn-id: http://core.svn.wordpress.org/trunk@54940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 20:55:23 +00:00
John Blackbourn
ffc55e249f Revisions: Remove an unnecessary call to _doing_it_wrong() and corresponding new text string from the implementation of the new wp_save_post_revision_revisions_before_deletion filter.
While the guard condition was technically correct, it's not practical or necessary to provide this protection for every use of every filter, and it adds unnecessary burden to translators to provide translations for strings that will likely not be seen.

Follow up to [55254].

Fixes #57320

Built from https://develop.svn.wordpress.org/trunk@55406


git-svn-id: http://core.svn.wordpress.org/trunk@54939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 20:49:20 +00:00
hellofromTonya
93dfe28aaf Themes: Add 3 and update 2 shadow presets in theme.json.
Adds Deep, Outlined, and Crisp default shadow presets to Core's `theme.json` file.

Updates the Natural and Sharp `'shadow'` styles.

These shadow presets are used to populate the Shadow tools in the Site Editor's Global Styles UI.

References:
* [https://github.com/WordPress/gutenberg/pull/46502 Gutenberg PR 46502]

Follow-up to [55176].

Props franz00, madhudollu, ajlende, beafialho, costdev, dhrupo, fabiankaegy, hellofromTonya, jameskoster, joen, kellychoffman, mamaduka, mtias, oandregal, priethor, richtabor, scruffian. 
Fixes #57708.
See #57559.
Built from https://develop.svn.wordpress.org/trunk@55405


git-svn-id: http://core.svn.wordpress.org/trunk@54938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 16:00:21 +00:00
Sergey Biryukov
3533ec3159 Media: Add WP_Image_Editor_Imagick::set_imagick_time_limit() method.
This aims to avoid timeout in Imagick operations.

Previously, Imagick operations could silently error by timeout and produce unexpected results. The new `::set_imagick_time_limit()` method, now used in `::resize()` and `::crop()`, will better handle garbage collection in these cases as well as better align Imagick's timeout with PHP timeout, assuming it is set.

Props drzraf, audrasjb, costdev, antpb, SergeyBiryukov.
Fixes #52569.
Built from https://develop.svn.wordpress.org/trunk@55404


git-svn-id: http://core.svn.wordpress.org/trunk@54937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 14:25:25 +00:00
gziolo
582feb3ffb HTML API: Set $this->html to protected to support subclassing
When the HTML API was introduced a number of fields were switched from private visibility to protected so that Gutenberg and other systems could more easily enhance the behaviors through subclassing. The $this->html property was overlooked but important for systems using the Tag Processor to stich HTML, specifically performing operations on innerHTML and innerText.

Follow-up [55203].
Props dmsnell.
See #57575.


Built from https://develop.svn.wordpress.org/trunk@55402


git-svn-id: http://core.svn.wordpress.org/trunk@54935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 06:24:22 +00:00
Dominik Schilling
6d0eaf9674 Taxonomy: Rename temporary variable in wp_queue_posts_for_term_meta_lazyload().
This ensures the `$term_ids` variable only contains term IDs and is not filled with full term objects due to deprecated term caching.

Introduced in [55252].

Props skithund, Chouby, joemcgill, flixos90, ocean90.
Fixes #57150.
Built from https://develop.svn.wordpress.org/trunk@55401


git-svn-id: http://core.svn.wordpress.org/trunk@54934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 21:04:17 +00:00
audrasjb
dd87b5a4bd Post WordPress 6.2 Beta 3 version bump.
Built from https://develop.svn.wordpress.org/trunk@55400


git-svn-id: http://core.svn.wordpress.org/trunk@54933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 18:06:25 +00:00
audrasjb
2e1bc6e81e WordPress 6.2 Beta 3.
Built from https://develop.svn.wordpress.org/trunk@55399


git-svn-id: http://core.svn.wordpress.org/trunk@54932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 17:24:21 +00:00
Sergey Biryukov
77dfc892fe Docs: Document default values for optional parameters in various DocBlocks.
Props paulkevan, costdev, audrasjb, SergeyBiryukov.
See #56792.
Built from https://develop.svn.wordpress.org/trunk@55398


git-svn-id: http://core.svn.wordpress.org/trunk@54931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 16:39:19 +00:00
TimothyBlynJacobs
9b806a3114 Recovery Mode: Use PasswordHash API directly when validating keys.
Previously, the wp_check_password function was used for validating keys, while the PasswordHash class was used for creating keys. This would prevent Recovery Mode from working on sites that provide a custom implementation for the wp_check_password pluggable function.

Props calvinalkan.
Fixes #56787.

Built from https://develop.svn.wordpress.org/trunk@55397


git-svn-id: http://core.svn.wordpress.org/trunk@54930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 15:59:18 +00:00
audrasjb
57d8df8ab1 Users: Fix confirmation link for multisite users with no role.
This fixes a regression introduced in [41163], where the link in change confirmation emails for users with no roles in a multisite install was incorrect, causing them to be unable to change their email address. This changeset replaces `admin_url()` with `self_admin_url()` to restore the previous fix.

Follow-up to [38876], [40632], [41165], [41163].

Props roytanck, SergeyBiryukov, johnbillion, afrin29.
Fixes #57164.

Built from https://develop.svn.wordpress.org/trunk@55396


git-svn-id: http://core.svn.wordpress.org/trunk@54929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 15:55:19 +00:00
hellofromTonya
f579bc0356 Comments: Restore global $comment assignment in comment_form_title().
Restores the global `$comment` assignment in `comment_form_title()`, which was mistakely removed in [55369].

As noted in the function's DocBlock:
{{{
@internal The $comment global must be present to allow template tags access to the current comment. See https://core.trac.wordpress.org/changeset/36512.
}}}

Follow-up to [55369].

Props hellofromTonya, costdev.
Fixes #53962.
Built from https://develop.svn.wordpress.org/trunk@55395


git-svn-id: http://core.svn.wordpress.org/trunk@54928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 15:28:17 +00:00
audrasjb
a8c80af126 Networks and Sites: Fix the attributes for the email input field on the new network user screen.
This reverts the email input field back to its previous state (before [55026]), except for the expected addition of the `required` attribute.

Follow-up to [55026].

Props johnbillion.
Fixes #38460.

Built from https://develop.svn.wordpress.org/trunk@55394


git-svn-id: http://core.svn.wordpress.org/trunk@54927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 14:52:18 +00:00
Sergey Biryukov
8211ef5c3a Tests: Remove duplicate DocBlock opening characters in tests/theme/wpTheme.php.
Follow-up to [814/tests], [904/tests], [50967].

Props mukesh27, costdev.
See #56792.
Built from https://develop.svn.wordpress.org/trunk@55393


git-svn-id: http://core.svn.wordpress.org/trunk@54926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 13:55:19 +00:00
gziolo
2b08f8960b Update the WP packages with fixes prior to WP 6.2 beta 3
Includes the following changes:

- Upgrade Playwright to 1.30.0
- [Block Editor - Inserter]: preload media categories empty check - client side
- Navigation: Fixes undo and redo for nesting operations in the navigation block's inspector
- Fix: OffCanvasEditor does not inserts submenu on collapsed items.
- OffCanvasEditor: Only allow some blocks to be converted to submenus
- Navigation: Updates "Add Submenu item" text to "Add Submenu link"
- Update: Make OffCanvasEditor use LeafMoreMenu by default.
- Template Part: Performance: Replace usage of wp_get_theme()->get_stylesheet() with get_stylesheet()
- Widget Editor: Fix a problem with 'Move to Widget Area' button not working
- Reusable Blocks: Use React 18 rendering for import dropdown
- useAsyncList: flush state updates when processing queue
- Refactor the site editor URLs for better backward compatibility
- Template editor: only disable the save button if no changes rather than hiding it
- [Quote]: Fix deprectated large style specificity rule
- Style Book: Allow button text labels for style book icon
- List View: Scroll selected block into view when single block selection changes
- Post editor: revert iframed editor for WP core only
- Fix the Publish region position and focus style.
- Remove "& Shadow" from the Border ScreenHeader title
- Site editor: specify focus state color for template navigation button

References: [1e2b2f680c Gutenberg's commit for publishing the packages]

Props ntsekouras, ellatrix.
See #57471.


Built from https://develop.svn.wordpress.org/trunk@55392


git-svn-id: http://core.svn.wordpress.org/trunk@54925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 13:09:42 +00:00
Peter Wilson
770f413fe7 HTTP API: Add fragment support to WP_Http::make_absolute_url().
Modifies `WP_Http::make_absolute_url()` to prevent it from dropping URL fragments, this in turn fixes the same issue for `links_add_base_url()`.

Props costdev, sergeybiryukov, dshanske, schlessera, jrf, desrosj, dd32.
Fixes #56231.


Built from https://develop.svn.wordpress.org/trunk@55370


git-svn-id: http://core.svn.wordpress.org/trunk@54903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 01:49:20 +00:00
Peter Wilson
a77704f1a3 Comments: Prevent replying to unapproved comments.
Introduces client and server side validation to ensure the `replytocom` query string parameter can not be exploited to reply to an unapproved comment or display the name of an unapproved commenter.

This only affects commenting via the front end of the site. Comment replies via the dashboard continue their current behaviour of logging the reply and approving the parent comment.

Introduces the `$post` parameter, defaulting to the current global post, to `get_cancel_comment_reply_link()` and `comment_form_title()`.

Introduces `_get_comment_reply_id()` for determining the comment reply ID based on the `replytocom` query string parameter.

Renames the parameter `$post_id` to `$post` in `get_comment_id_fields()` and `comment_id_fields()` to accept either a post ID or `WP_Post` object.

Adds a new `WP_Error` return state to `wp_handle_comment_submission()` to prevent replies to unapproved comments. The error code is `comment_reply_to_unapproved_comment` with the message `Sorry, replies to unapproved comments are not allowed.`.

Props costdev, jrf, hellofromtonya, fasuto, boniu91, milana_cap.
Fixes #53962.

Built from https://develop.svn.wordpress.org/trunk@55369


git-svn-id: http://core.svn.wordpress.org/trunk@54902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-21 01:45:24 +00:00
hellofromTonya
5bf74c0433 Editor: Fix 'wp-block-library-theme' style enqueue conditions.
Fixes the conditions for when to enqueue the opinionated block styles (i.e. `'wp-block-library-theme'` stylesheet):

* the theme adds `'wp-block-styles'` theme support;
* and no editor styles are declared.

This resolves an issue with themes that do not add the `'wp-block-styles'` theme support while not impacting themes that do.

Follow-up to [53419], [52069], [50761], [44157].

Props mikachan, costdev, glendaviesnz, hellofromTonya, jffng, mamaduka, ndiego, poena, sannevndrmeulen, scruffian.
Fixes #57561.
Built from https://develop.svn.wordpress.org/trunk@55368


git-svn-id: http://core.svn.wordpress.org/trunk@54901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-20 21:13:27 +00:00
Sergey Biryukov
89a3b0e9f2 Bootstrap/Load: Check that either mysqli_connect() or mysql_connect() is available.
This resolves a fatal error and displays an actionable message if the `mysqli` PHP extension is missing.

Previously, `wp_check_php_mysql_versions()` performed an early check whether `mysql`, `mysqli`, or `mysqlnd` extensions are loaded, but that did not work if the `mysqlnd` extension is the only one present.

Checking specifically for `mysqli_connect()` or `mysql_connect()` functions should be a more reliable approach and more closely mirrors the existing checks in the `wpdb` class.

Follow-up to [1955], [4489], [7234], [12732], [19760], [27257], [36434].

Props bgin, desrosj, dimadin, ipajen, hellofromTonya, sc0ttkclark, azaozz, SergeyBiryukov.
Fixes #51988.
Built from https://develop.svn.wordpress.org/trunk@55367


git-svn-id: http://core.svn.wordpress.org/trunk@54900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-20 16:05:19 +00:00
gziolo
4046f55c78 Backport editor changes from Gutenberg for WordPress 6.2 Beta 3
Updates the `@wordpress` packages to include the following change:

- Pin `valtio` version

References: [ccabeeffe1 Gutenberg's commit for publishing the packages]

Props ntsekouras.
See #57471.


Built from https://develop.svn.wordpress.org/trunk@55366


git-svn-id: http://core.svn.wordpress.org/trunk@54899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-20 13:29:05 +00:00
Sergey Biryukov
1553e3fa00 Coding Standards: Rename $post_ID variable to $post_id in various files.
The `$post_ID` variable is [546f59c678/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php (L54) technically allowed in WPCS], as there is a global of the same name that needs to remain for backward compatibility. However, this name is mostly a remnant of legacy code, and switching to `$post_id` where appropriate brings more consistency with the rest of core.

Additionally, this commit resolves a few WPCS warnings in core:
{{{
Variable "$post_IDs" is not in valid snake_case format
}}}

This affects:
* Function parameters in:
 * `add_meta()`
 * `post_preview()`
 * `WP_Embed::delete_oembed_caches()`
 * `WP_Embed::cache_oembed()`
 * `wp_get_post_cats()`
 * `wp_set_post_cats()`
 * `wp_unique_post_slug()`
 * `wp_set_post_categories()`
 * `wp_check_post_hierarchy_for_loops()`
 * `wp_add_trashed_suffix_to_post_name_for_trashed_posts()`
 * `wp_filter_wp_template_unique_post_slug()`
 * `wp_xmlrpc_server::add_enclosure_if_new()`
 * `wp_xmlrpc_server::attach_uploads()`
 * `wp_xmlrpc_server::mt_getTrackbackPings()`
* Internal variables in:
 * `wp_ajax_inline_save()`
 * `wp_ajax_set_post_thumbnail()`
 * `wp_ajax_get_post_thumbnail_html()`
 * `edit_post()`
 * `bulk_edit_posts()`
 * `wp_write_post()`
 * `WP_Embed::shortcode()`
 * `wp_insert_post()`
 * `wp_xmlrpc_server::_insert_post()`
 * `wp_xmlrpc_server::blogger_getPost()`
 * `wp_xmlrpc_server::blogger_newPost()`
 * `wp_xmlrpc_server::blogger_editPost()`
 * `wp_xmlrpc_server::blogger_deletePost()`
 * `wp_xmlrpc_server::mw_getPost()`
 * `wp_xmlrpc_server::mw_newPost()`
 * `wp_xmlrpc_server::mw_editPost()`
 * `wp_xmlrpc_server::mt_getPostCategories()`
 * `wp_xmlrpc_server::mt_setPostCategories()`
 * `wp_xmlrpc_server::mt_publishPost()`
 * `wp_xmlrpc_server::pingback_ping()`
* Hook parameters in:
 * `oembed_ttl`
 * `embed_oembed_html`
 * `wp_insert_post_parent`
 * `add_trashed_suffix_to_trashed_posts`
 * `pre_post_update`
 * `edit_attachment`
 * `attachment_updated`
 * `add_attachment`
 * `edit_post_{$post->post_type}`
 * `edit_post`
 * `post_updated`
 * `save_post_{$post->post_type}`
 * `save_post`
 * `wp_insert_post`
 * `pre_wp_unique_post_slug`
 * `wp_unique_post_slug`
 * `xmlrpc_call_success_blogger_newPost`
 * `xmlrpc_call_success_blogger_editPost`
 * `xmlrpc_call_success_blogger_deletePost`
 * `xmlrpc_call_success_mw_newPost`
 * `xmlrpc_call_success_mw_editPost`

Note: The name change only affects variable names and DocBlocks.

The change does not affect the `$post_ID` global still used in a few places.

Follow-up to [51399], [52958], [53723], [53729], [55190], [55308], [55334].

Props mahekkalola, tanjimtc71, SergeyBiryukov.
Fixes #57692.
Built from https://develop.svn.wordpress.org/trunk@55365


git-svn-id: http://core.svn.wordpress.org/trunk@54898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-19 15:05:22 +00:00
Sergey Biryukov
454752d283 Coding Standards: Improve variables names in post and comment page link functions.
This commit renames a few internal variables for better clarity and consistency:

* `$nextpage` to `$next_page` in:
 * `get_next_posts_page_link()`
 * `get_next_posts_link()`
 * `get_next_comments_link()`
* `$nextpage` to `$previous_page` in:
 * `get_previous_posts_page_link()`
* `$prevpage` to `$previous_page` in:
 * `get_previous_comments_link()`

Includes minor code layout fixes for better readability.

Follow-up to [5045], [8502], [8961], [28111].

Props dalirajab, SergeyBiryukov.
Fixes #57746.
Built from https://develop.svn.wordpress.org/trunk@55364


git-svn-id: http://core.svn.wordpress.org/trunk@54897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-18 15:09:18 +00:00
Sergey Biryukov
89bb47e4e1 Docs: Add www. prefix to some PHP manual links in code comments.
This avoids an extra redirect and brings more consistency with other links to the PHP website in core.

Follow-up to [42980], [50914], [55355].

See #56792.
Built from https://develop.svn.wordpress.org/trunk@55363


git-svn-id: http://core.svn.wordpress.org/trunk@54896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-18 14:23:21 +00:00
danielbachhuber
07720ec51f REST API: Only use Latin characters in test filenames.
Non-Latin characters can break SVN checkout in some environments.

Follow up from [55294].

See #57329, #57761.

Built from https://develop.svn.wordpress.org/trunk@55362


git-svn-id: http://core.svn.wordpress.org/trunk@54895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-17 18:39:22 +00:00
TimothyBlynJacobs
42b25d58ea REST API: Normalize WP_REST_Server::dispatch() to return a response object.
Previously, the `rest_pre_dispatch` filter could be used to return a `WP_Error` instance. This would cause a fatal error for `rest_post_dispath` 
filters that were rightly expecting a `WP_REST_Response` object to be passed instead.

Props DaveFX, felipeelia.
Fixes #56566.

Built from https://develop.svn.wordpress.org/trunk@55361


git-svn-id: http://core.svn.wordpress.org/trunk@54894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-17 15:45:24 +00:00
Sergey Biryukov
db71029a47 Users: Correct the error code in wp_insert_user() when login matches an existing email.
Move the test next to the other tests for `user_login`.

Follow-up to [55358].

See #57394.
Built from https://develop.svn.wordpress.org/trunk@55360


git-svn-id: http://core.svn.wordpress.org/trunk@54893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-17 10:15:22 +00:00
audrasjb
818e9581a8 Upgrade/Install: Update available theme updates count when a theme si deleted.
This changeset fixes an issue where the available theme updates count was not updated after a theme is deleted.

Props nazmulhasan103, riccardodicurti, sabernhardt, ironprogrammer, costdev, robinwpdeveloper, rahmantasnia.
Fixes #57183.

Built from https://develop.svn.wordpress.org/trunk@55359


git-svn-id: http://core.svn.wordpress.org/trunk@54892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-17 09:54:19 +00:00
Adam Silverstein
1b873c8a19 Login and Registration: prevent registering with username that matches previous user email.
When registering a new user, check that no existing user has an email matching the username.

Prevents a login name collision when one user registers with the email address user@test.com and a second user tries to register with the username user@test.com.

Props buutqn, dunhakdis, roytanck, ajayver.
Fixes #57394.


Built from https://develop.svn.wordpress.org/trunk@55358


git-svn-id: http://core.svn.wordpress.org/trunk@54891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-17 08:10:22 +00:00
audrasjb
f0789b6423 Docs: Replace HTTP with HTTPS in PHP Manual links located in WP_Privacy_Policy_Content class.
Follow-up to [55355].

See #56792, #57017.

Built from https://develop.svn.wordpress.org/trunk@55356


git-svn-id: http://core.svn.wordpress.org/trunk@54889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 23:11:28 +00:00
audrasjb
5fd4961a97 Docs: Replace HTTP with HTTPS in PHP Manual links located in wp-load.php.
Props shamimmiashuhagh.
See #56792.

Built from https://develop.svn.wordpress.org/trunk@55355


git-svn-id: http://core.svn.wordpress.org/trunk@54888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 23:08:20 +00:00
Andrew Ozz
e3d1a1291f Filesystem API: Use trailingslashit( $path ) instead of $path . '/'. Fixes a warning when $path already ends with a slash.
Props: costdev, afragen, mukesh27.
Fixes: #57516.
Built from https://develop.svn.wordpress.org/trunk@55354


git-svn-id: http://core.svn.wordpress.org/trunk@54887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 22:13:28 +00:00
Helen Hou-Sandí
c54e29fd68 Build/Test Tools: Improve devcontainer setup for non-Codespaces usage
This now runs in local Docker as well. Sets the executable propset to explicitly identify `install-tool.sh` and `setup.sh` as executable. Unclear if this will sync via the Git mirror; ideally it would as otherwise the two files show as modified in a Git clone even in a fresh container.

Props samruddhikhandale.
See #57187.

Built from https://develop.svn.wordpress.org/trunk@55353


git-svn-id: http://core.svn.wordpress.org/trunk@54886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 03:50:19 +00:00
Sergey Biryukov
6ead8cfda8 Coding Standards: Replace strval() with (string) type casting in wp_nav_menu().
This adjusts a newly introduced instance for consistency with the rest of core.

Follow-up to [49108], [55059].

See #57169.
Built from https://develop.svn.wordpress.org/trunk@55352


git-svn-id: http://core.svn.wordpress.org/trunk@54885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 00:04:21 +00:00
Sergey Biryukov
f8dd6946fc I18N: Check that $wp_locale global is set before calling its methods.
This avoids a fatal error if these functions are called in a mu-plugin before `$wp_locale` is set:
* `wp_get_list_item_separator()`
* `wp_get_word_count_type()`

Follow-up to [52929], [52933], [55279], [55295].

Props kraftbj.
Fixes #56698.
Built from https://develop.svn.wordpress.org/trunk@55351


git-svn-id: http://core.svn.wordpress.org/trunk@54884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 23:37:17 +00:00
audrasjb
ae9744d1cc I18N: Add new strings to about.php for use with end-of-life updates.
This changeset adds two additional translation strings in the changelog file, for use when releasing the final version of WordPress on a particular branch.

Props peterwilsoncc, audrasjb, mukesh27, mukesh27.
Fixes #57216.

Built from https://develop.svn.wordpress.org/trunk@55350


git-svn-id: http://core.svn.wordpress.org/trunk@54883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 23:33:18 +00:00
audrasjb
0bccdce442 Docs: Use correct 6.2.0 @since version in multiple docblocks.
Props kebbet, audrasjb, mukesh27.
See #56792.

Built from https://develop.svn.wordpress.org/trunk@55349


git-svn-id: http://core.svn.wordpress.org/trunk@54882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 22:56:20 +00:00
Sergey Biryukov
b62555410f Docs: Update the wording for the Update Services link on Writing Settings screen.
The Codex URL was replaced with the corresponding HelpHub article a while ago.

Follow-up to [49912].

See #48987.
Built from https://develop.svn.wordpress.org/trunk@55347


git-svn-id: http://core.svn.wordpress.org/trunk@54880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 19:18:18 +00:00
Sergey Biryukov
b9a31d5343 Docs: Improve code comments in some sanitizing functions.
This aims to clarify a few inline comments related to removing percent-encoded characters and HTML entities.

Affected functions:
* `sanitize_user()`
* `sanitize_title_with_dashes()`
* `sanitize_html_class()`
* `_sanitize_text_fields()`
* `get_comments_number_text()`

Follow-up to [465], [3454], [11433], [12503], [37987].

Props ace100, tanjimtc71, codemonksuvro, SergeyBiryukov.
Fixes #57712.
Built from https://develop.svn.wordpress.org/trunk@55346


git-svn-id: http://core.svn.wordpress.org/trunk@54879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 13:06:21 +00:00
Peter Wilson
5deb3698e5 Editor: Prevent KSES stripping global layout style properties.
Layout style properties are stored using indirect values, rather than direct CSS properties. 

Allow users without the `unfiltered_html` capability to modify global styles using the indirect block spacing properties `contentSize`, `wideSize`, and `blockGap`, using a mapping of the eventual CSS property to the indirect property stored in `theme.json`. The mapped CSS property is then used for CSS validation.

Props andrewserong, costdev, hellofromtonya, mamaduka, mmtr86.
Fixes #57321.



Built from https://develop.svn.wordpress.org/trunk@55345


git-svn-id: http://core.svn.wordpress.org/trunk@54878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 03:57:17 +00:00
Peter Wilson
fc49b0b92a Date/Time: Revert mysql2date changes in [55343].
These changes will be targeted to the 6.3 release.

See #57705.


Built from https://develop.svn.wordpress.org/trunk@55344


git-svn-id: http://core.svn.wordpress.org/trunk@54877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 02:02:16 +00:00
spacedmonkey
0dc9b1a9b8 Date/Time: Save a call to wp_timezone in mysql2date.
Save a call to `wp_timezone` in `mysql2date` by saving the timezone to a variable and pass it into `wp_date` function call. 

Props spacedmonkey, costdev, SergeyBiryukov, audrasjb.
Fixes #57705.
Built from https://develop.svn.wordpress.org/trunk@55343


git-svn-id: http://core.svn.wordpress.org/trunk@54876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 21:41:20 +00:00
hellofromTonya
14f8608af9 Build/Test Tools: Fix invalid styles data type PHP Warning in REST_Block_Type_Controller_Test::test_get_item_invalid().
Sets the `styles` block setting to an empty array in the `REST_Block_Type_Controller_Test::test_get_item_invalid()` test to resolve:

{{{
Warning: foreach() argument must be of type array|object, string given in wp-includes/class-wp-theme-json.php on line 835
}}}

Previously the test set the `styles` setting to a string value, which is incompatible. The problem surfaced after [55172] added a `foreach` to iterate the `styles`. The root cause was due to this test passing a string instead of an array.

Why?

`WP_Block_Type` `styles` property is documented as only accepting an array data type. At the time of this changeset, it does not validate before setting the property.

Code interacting with the property expects it to be an array data type. The PHP Warning alerts that of a doing it wrong when the incorrect data type is registered for the block type.

Follow-up to [55172], [48173].

Props tanjimtc71, hellofromTonya, kapilpaul.
Fixes #57706.
Built from https://develop.svn.wordpress.org/trunk@55342


git-svn-id: http://core.svn.wordpress.org/trunk@54875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 19:10:21 +00:00
hellofromTonya
566eaaafa2 Build/Test Tools: Fix inaccurate coverage in Tests_Functions_wpListPluck::set_up().
The call stack for `WP_UnitTestCase_Base::set_up()` includes a call to `WP_List_Util::pluck()`, which creates an inaccurate coverage report for this method.

To resolve, `parent::set_up()` is removed from `Tests_Functions_wpListPluck::set_up()`.

To ensure that deprecation and incorrect usage notices continue to be detectable, `$this->expectDeprecated()` is added in the test's `set_up()` fixture.

Follow-up to [51663], [28900].

Props costdev, jrf, SergeyBiryukov, audrasjb.
Fixes #56706.
Built from https://develop.svn.wordpress.org/trunk@55341


git-svn-id: http://core.svn.wordpress.org/trunk@54874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 18:21:23 +00:00
audrasjb
4f9ff9b25b Post WordPress 6.2 Beta 2 version bump.
Built from https://develop.svn.wordpress.org/trunk@55340


git-svn-id: http://core.svn.wordpress.org/trunk@54873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 18:05:19 +00:00
audrasjb
759a05a840 WordPress 6.2 Beta 2.
Built from https://develop.svn.wordpress.org/trunk@55339


git-svn-id: http://core.svn.wordpress.org/trunk@54872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 17:46:23 +00:00
hellofromTonya
ab35789175 Editor: Remove missing postType and postId query args Site Editor redirect.
Removes the server-side redirection if missing `postType` and `postId` query args when visiting Site Editor. Why? This redirect is no longer needed as the routing is now handled client side (via [55333]).

References:
* [https://github.com/WordPress/gutenberg/pull/48023 Gutenberg PR 48023]
* [https://github.com/WordPress/gutenberg/pull/47777 Gutenberg PR 47777]

Follow-up to [55333], [53413], [53093].

Props ntsekouras, youknowriad.
Fixes #57716.
Built from https://develop.svn.wordpress.org/trunk@55338


git-svn-id: http://core.svn.wordpress.org/trunk@54871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 16:26:18 +00:00
Sergey Biryukov
fb6c959884 Tests: Merge file-level and class-level DocBlocks in various unit test files.
Per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#6-file-headers documentation standards], whenever possible, all WordPress files should contain a header DocBlock, regardless of the file’s contents – this includes files containing classes.

However, this recommendation makes less sense for unit test classes if not applied consistently, and the duplicate tags cause some confusion.

This commit aims to reduce confusion and avoid repeating information by combining the DocBlocks.

Follow-up to [40607], [43183], [43291], [43292], [43499], [43568], [44502], [44535], [44628], [44786], [44824], [44906], [44909], [46175].

Props wojtekn, antonvlasenko, arafatjamil01, hztyfoon, mukesh27, costdev, jamilbd07, robinwpdeveloper, SergeyBiryukov.
Fixes #57099.
Built from https://develop.svn.wordpress.org/trunk@55337


git-svn-id: http://core.svn.wordpress.org/trunk@54870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-14 16:12:17 +00:00