The function was erroneously calling `is_wp_error()` on the result of a `get_post()` call, which returns `null` on failure, and never returns a `WP_Error` object.
Previously, passing a non-existing post ID to the function would result in a home URL being returned and a few `Attempt to read property "post_type, post_name, hierarchical..." on null` PHP warnings.
This commit ensures `get_post_permalink()` returns `false` on failure, which brings parity with `get_permalink()`.
Includes a unit test to confirm the correct behavior.
Follow-up to [12923], [13023], [32606].
Props renegeuze, manzoorwani.jk.
Fixes#45329.
git-svn-id: https://develop.svn.wordpress.org/trunk@53733 602fd350-edb4-49c9-b593-d223f7449a82
This removes all CSS definitions related to the `.icon16` class. Research shows that current ecosystem usage of this class is extremely minimal.
This selector was used for the Welcome Panel and Welcome Screen in WordPress 3.3 (see [19163] and [19197]. The icons were removed for WordPress 3.5 in [22018], but the related CSS remained, and were also included when the MP6 admin re-skinning was merged in [26072].
Props afercia, mmaumio, isabel_brison, sabernhardt, audrasjb, desrosj.
Fixes#35717.
git-svn-id: https://develop.svn.wordpress.org/trunk@53731 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a PHP compatibility error in `wp_handle_comment_submission()`:
* `Trailing comma's are not allowed in function calls in PHP 7.2 or earlier`
Follow-up to [53729].
See #55647, #56244.
git-svn-id: https://develop.svn.wordpress.org/trunk@53730 602fd350-edb4-49c9-b593-d223f7449a82
The `wp_new_comment()`, `wp_update_comment()`, and `wp_filter_comment()` functions already normalize the `user_ID` parameter internally to `user_id`, which matches the database field name.
This commit aims to bring some consistency when passing the parameter in core.
The corresponding `$user_ID` variable is also renamed to `$user_id` to match the other variables when not referring to the `$user_ID` global, which has an exception in the WordPress coding standards.
Follow-up to [8543], [8720], [12267], [12300], [26491], [28915], [28922], [34799], [49303].
See #55647, #56244.
git-svn-id: https://develop.svn.wordpress.org/trunk@53729 602fd350-edb4-49c9-b593-d223f7449a82
This changeset replaces `#d63638` (contrast ratio: 4.40) with `#b32d2e` (contrast ratio: 5.87) in Plugins screen row action links when the site is in recovery mode.
Props kebbet, mukesh27, joedolson, audrasjb.
Fixes#56190.
git-svn-id: https://develop.svn.wordpress.org/trunk@53726 602fd350-edb4-49c9-b593-d223f7449a82
This moves the `::prepare_links()` methods in REST API classes next to `::prepare_item_for_response()` where they are used, to bring some consistency across the classes and make code navigation easier.
Includes wrapping some long lines for better readability.
Follow-up to [52079], [52051], [52342], [53721], [53722].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53724 602fd350-edb4-49c9-b593-d223f7449a82
This fixes two WPCS warnings:
* `Variable "$comment_post_ID" is not in valid snake_case format`
* `Variable "$comment_author_IP" is not in valid snake_case format`
While matching the database fields of the same name, these variables did not follow the WordPress coding standards, and are now renamed to address that.
Note: The name change only affects internal variables and parameters for a few actions receiving a comment post ID:
* `edit_comment`
* `comment_id_not_found`
* `comment_closed`
* `comment_on_trash`
* `comment_on_draft`
* `comment_on_password_protected`
* `pre_comment_on_post`
The change does not affect parameters for functions receiving an array of comment data:
* `wp_insert_comment()`
* `wp_new_comment()`
* `wp_update_comment()`
* `wp_handle_comment_submission()`
The associated array keys still match the database fields: `comment_post_ID` and `comment_author_IP`.
Follow-up to [1706], [2894], [8720], [28427], [28437], [28457], [34799], [53720],
See #55647, #56244.
git-svn-id: https://develop.svn.wordpress.org/trunk@53723 602fd350-edb4-49c9-b593-d223f7449a82
Move logic to from `prepare_item_for_response` to `prepare_links` method to bring `WP_REST_Taxonomies_Controller` class inline with other REST API controllers.
Props Spacedmonkey, timothyblynjacobs, dlh.
Fixes#56020.
git-svn-id: https://develop.svn.wordpress.org/trunk@53722 602fd350-edb4-49c9-b593-d223f7449a82
Move logic to from `prepare_item_for_response` to `prepare_links` method to bring `WP_REST_Post_Types_Controller` class inline with other REST API controllers.
Props Spacedmonkey, timothyblynjacobs, dlh.
Fixes#56019.
git-svn-id: https://develop.svn.wordpress.org/trunk@53721 602fd350-edb4-49c9-b593-d223f7449a82
This was present in the initial import of b2 files, but appears to have never been used in WordPress core.
Follow-up to [3], [636], [637], [1616].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53720 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a `Variable "$comment_post_ID" is not in valid snake_case format` WPCS warning.
`$comment_post_ID`, while matching the database field of the same name, does not follow the WordPress coding standards, so the variable is now renamed to `$comment_post_id`.
Additionally, these variables are renamed for clarity:
* `$tb_id` to `$post_id` (this was not the trackback ID)
* `$tb_url` to `$trackback_url`
Follow-up to [172], [637], [1616],
See #55647, #56244.
git-svn-id: https://develop.svn.wordpress.org/trunk@53719 602fd350-edb4-49c9-b593-d223f7449a82
When registering block through PHP, using `register_block_type` function, newly introduced `ancestor` block setting in `block.json` was not recognised. It worked though, when block is registered from JavaScript.
Props lovor, annezazu.
Fixes#56184.
git-svn-id: https://develop.svn.wordpress.org/trunk@53718 602fd350-edb4-49c9-b593-d223f7449a82
This changeset improves the vertical alignment of the plugin update button in the Plugins screen.
Props Presskopp, sabernhardt, costdev, eherman24.
Fixes#56123.
git-svn-id: https://develop.svn.wordpress.org/trunk@53717 602fd350-edb4-49c9-b593-d223f7449a82
When using a given block, patterns which use that block can be suggested. This changeset adds `blockType` suggestion for several Twenty Twenty-One bundled patterns.
Props ryelle, poena, audrasjb.
Fixes#53647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53716 602fd350-edb4-49c9-b593-d223f7449a82
This aims to clarify the time units for some timeout or expiration values.
Follow-up to [11823], [13177], [21996], [37747].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53714 602fd350-edb4-49c9-b593-d223f7449a82
This reduces the amount of code to edit in case of any changes to the default permalink structures.
Follow-up to [53706], [53710].
See #55647, #55498.
git-svn-id: https://develop.svn.wordpress.org/trunk@53713 602fd350-edb4-49c9-b593-d223f7449a82
This brings more consistency with how the home URL is retrieved elsewhere in the admin.
Follow-up to [1567], [1664], [2746], [3029], [4144], [53710].
Props sabernhardt.
Fixes#56235.
git-svn-id: https://develop.svn.wordpress.org/trunk@53712 602fd350-edb4-49c9-b593-d223f7449a82
This is intended as an introduction to permalink structure selection.
Props kebbet, costdev, hasanuzzamanshamim, mukesh27.
Fixes#55947.
git-svn-id: https://develop.svn.wordpress.org/trunk@53711 602fd350-edb4-49c9-b593-d223f7449a82
Includes:
* Wrapping longer lines and reducing alignment levels to fit more data on the screen.
* Restoring `esc_attr()` for input values, which may include translatable parts.
* Adding comments to closing `</div>` tags and PHP `endif` statements.
* Reducing the context switching between HTML and PHP.
* Balancing PHP conditionals to better reflect the structure.
* Removing repeated function calls to improve performance.
* Renaming some variables for clarity and consistency.
Follow-up to [470], [601], [963], [1227], [1664], [2746], [3029], [6976], [7230], [11350], [14051], [14553], [21891], [34691], [34749], [37747], [38066], [41182], [41986], [42343], [43571], [48710], [50830], [51892], [53706].
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53710 602fd350-edb4-49c9-b593-d223f7449a82
Issues appropriate audible messages via `wp.a11y.speak()` when `ajax-response.js` generates an error via `wp_die()`.
Props afercia, alexstine.
Fixes#54483.
git-svn-id: https://develop.svn.wordpress.org/trunk@53709 602fd350-edb4-49c9-b593-d223f7449a82
Restructure the permalink settings fields so URL formats are communicated to screen readers through `aria-describedby` relationships, avoid the usage of implicitly labeled input fields, labeling the custom permalink format correctly, and clarifying values. Make settings `table` element presentational.
Props rishishah, sabernhardt, kebbet.
Fixes#55498.
git-svn-id: https://develop.svn.wordpress.org/trunk@53706 602fd350-edb4-49c9-b593-d223f7449a82
The associated changes were backported to the 6.0 branch, so the version should be 6.0.1 instead of 6.1.0.
This affects:
* `@since` tag for the `block-templates` feature in `create_initial_theme_features()`.
* `@since` tag for the `show_on_front`, `page_on_front`, and `page_for_posts` options on the REST API settings endpoint.
Follow-up to [53590], [53661].
Props tommusrhodus, johnbillion.
Fixes#56225.
git-svn-id: https://develop.svn.wordpress.org/trunk@53704 602fd350-edb4-49c9-b593-d223f7449a82
Previously, it was used in core and older bundled themes to display the list of allowed tags in the comment form.
Follow-up to [709], [2009], [2012], [2032], [2040], [13030], [14365], [32858], [34316], [34351].
See #55646.
git-svn-id: https://develop.svn.wordpress.org/trunk@53703 602fd350-edb4-49c9-b593-d223f7449a82
Since the parameter accepts not only a user's ID, but also a `WP_User` object, `$user` is a more appropriate name, which better aligns with the `$post` parameter of functions that accept a post ID or a `WP_Post` object.
The pre-existing internal `$user` variable which contained a `WP_User` object is renamed to `$user_object` for clarity.
Follow-up to [38955].
Props aristath, poena, afercia, SergeyBiryukov.
See #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53702 602fd350-edb4-49c9-b593-d223f7449a82
* Move the colon inside the `<strong>` tags in some `Error:` prefixes, to match other strings.
* Move the full stop at the end of some sentences outside of the `<strong>` tags used for individual phrases.
Follow-up to [11669], [23844], [53118], [53458], [53476].
Props NekoJonez, Presskopp.
Fixes#56027.
git-svn-id: https://develop.svn.wordpress.org/trunk@53700 602fd350-edb4-49c9-b593-d223f7449a82
This replaces the `VHOST` and `SUBDOMAIN_INSTALL` constant names in a message in `ms_subdomain_constants()` with placeholders, as they don't need to be translated.
Follow-up to [36773].
Props weboccults, hztyfoon, pratiweb.
Fixes#56216.
git-svn-id: https://develop.svn.wordpress.org/trunk@53699 602fd350-edb4-49c9-b593-d223f7449a82
This introduces the following new filters:
* `wp_send_new_user_notification_to_admin`
* `wp_send_new_user_notification_to_user`
Props janthiel, costdev, audrasjb, peterwilsoncc
Fixes#54874
git-svn-id: https://develop.svn.wordpress.org/trunk@53698 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the post lock data returned by the Heartbeat API is consistent.
Previously, `wp_check_locked_posts()` was updated to return the name of the user currently editing the post, but the `wp_refresh_post_lock()` response did not get a similar change.
Follow-up to [53070].
Props nathan.noom.
Fixes#56197.
git-svn-id: https://develop.svn.wordpress.org/trunk@53692 602fd350-edb4-49c9-b593-d223f7449a82
Syncing stable blocks from the Gutenberg repository to wordpress-develop was a manual process, but it got automated with the script that runs together with syncing WordPress packages changed in the Gutenberg package.
Props zieladam.
Fixes#56179.
git-svn-id: https://develop.svn.wordpress.org/trunk@53688 602fd350-edb4-49c9-b593-d223f7449a82
- Deprecate `wp_get_attachment_thumb_file()`.
- Make `wp_get_attachment_thumb_url()` an alias of `wp_get_attachment_image_url()`. This fixes it to return the proper thumbnail URL and fall back to returning the URL to `image_meta['thumb']` if only that exists.
Props: markhowellsmead, mukesh27, csesumonpro, SergeyBiryukov, mikeschroder, killua99, joemcgill, mashukushibiki, mfgmicha, swissspidy, romulodl, nacin, JoshuaAbenazer, wonderboymusic, lonnylot, azaozz.
git-svn-id: https://develop.svn.wordpress.org/trunk@53685 602fd350-edb4-49c9-b593-d223f7449a82
This changeset removes a duplicate definition of the `type_label` property and consolidates the description of this property.
Props dlh, SergeyBiryukov.
Fixes#56072.
git-svn-id: https://develop.svn.wordpress.org/trunk@53678 602fd350-edb4-49c9-b593-d223f7449a82
This removes an extra `foreach` loop and the only variable variable (`$$component`) in core.
Follow-up to [20088,28342,28736-28747], [41629], [41820], [42226], [53670].
Props johnjamesjacoby.
See #54877, #55647.
git-svn-id: https://develop.svn.wordpress.org/trunk@53671 602fd350-edb4-49c9-b593-d223f7449a82
Ensure the database port number is recorded as an integer or `null` (the default port) when parsing the database host.
This is to prevent PHP/MySQLi throwing an exception caused by ports represented as numeric strings.
Props audrasjb, azouamauriac, chaion07, costdev, johnjamesjacoby, jrf, sergeybiryukov.
Fixes#54877.
git-svn-id: https://develop.svn.wordpress.org/trunk@53670 602fd350-edb4-49c9-b593-d223f7449a82
No longer delete the default term option in `unregister_taxonomy()` to improve database performance.
Since taxonomies are registered at runtime and can't be unregistered unless they're already registered, prior to this
change the option was created and deleted on each request.
Deleting the option should occur on a one-time opperation such as plugin deactivation.
Follow up to [48480].
Props dlh.
Fixes#54472.
git-svn-id: https://develop.svn.wordpress.org/trunk@53669 602fd350-edb4-49c9-b593-d223f7449a82
Patterns on the [https://wordpress.org/patterns/ Pattern Directory] can have keywords for better discoverability while searching. The way these are stored [69548ff1f0 was changed from a taxonomy to meta value], but the `/wp/v2/pattern-directory/patterns` endpoint was still pulling from that old value.
The correct property to use for this field is `meta.wpop_keywords`, which returns a single string with comma-separated keywords.
Props ryelle, TimothyBlynJacobs.
See #56126.
git-svn-id: https://develop.svn.wordpress.org/trunk@53665 602fd350-edb4-49c9-b593-d223f7449a82