Adds a new filter to alter the output of `get_the_author_link`. This change also adds unit tests for the new filter.
Props dshanske, donmhico, audrasjb, peterwilsoncc, SergeyBiryukov.
Fixes#51859.
git-svn-id: https://develop.svn.wordpress.org/trunk@53147 602fd350-edb4-49c9-b593-d223f7449a82
This change improves the `esc_xml()` function by replacing two `empty()` checks with `isset()` to cover values that are not equal to `''` but still returning `true` when checked with `empty()`, like `'0'`, `0` or `false`. It also updates the related unit tests accordingly.
Props rumpel2116, pbiron.
Fixes#55399.
git-svn-id: https://develop.svn.wordpress.org/trunk@53144 602fd350-edb4-49c9-b593-d223f7449a82
This changes updates many strings to remove self-references to an undefined "we" collective across the WordPress Administration.
The goal of this change is to better match the guidelines and recommendations set forth in the make/core handbook, specifically:
> the word "we" should be avoided (…) unless its made very clear which group is speaking.
Props johnbillion, shital-patel, audrasjb, marybaum, SergeyBiryukov, peterwilsoncc, johnjamesjacoby, kebbet, costdev, chaion07, davidbaumwald.
Fixes#46057.
git-svn-id: https://develop.svn.wordpress.org/trunk@53131 602fd350-edb4-49c9-b593-d223f7449a82
Add post type and taxonomy specific registration argument hooks.
Introduces the filters `register_{$post_type}_post_type_args` and `register_{$taxonomy}_taxonomy_args`. Introduces the actions `registered_post_type_{$post_type}` and `registered_taxonomy_{$taxonomy}`.
Props pbiron, dlh, davidbaumwald, hellofromTonya, milana_cap.
Fixes#53212.
git-svn-id: https://develop.svn.wordpress.org/trunk@53126 602fd350-edb4-49c9-b593-d223f7449a82
Remove the `link[rel=alternate]` element from the HTML header when the comment feeds are disabled. Previously the HTML element was output with an empty `href` attribute.
The element is removed if `get_post_comments_feed_link()` returns an empty string or the feed is disabled via the `feed_links_show_comments_feed` filter.
Props barryceelen, audrasjb, costdev, rachelbaker, Boniu91.
Fixes#54703.
git-svn-id: https://develop.svn.wordpress.org/trunk@53125 602fd350-edb4-49c9-b593-d223f7449a82
This updates several NPM dependencies to the latest versions, including:
- `check-node-version` from `4.1.0` to `4.2.1`.
- `dotenv` from `10.0.0` to `16.0.0`.
- `dotenv-expand` from `5.1.0` to `8.0.3`.
- `grunt-contrib-concat` from `2.0.0` to `2.1.0`.
- `grunt-contrib-jshint` from `3.1.1` to `3.2.0`.
- `grunt-contrib-uglify` from `5.0.1` to `5.1.0`.
- `qunit` from `2.17.2` to `2.18.1`.
- `sass` from `1.43.4` to `1.50.0`.
- `sinon` from `12.0.1` to `13.0.1`.
- `sinon-test` from `3.1.1` to `3.1.3`.
- `uglify-js` from `3.14.3` to `3.15.3`.
- `wait-on` from `6.0.0` to `6.0.1`.
The updates to `dotenv` and `dotenv-expand` required a minor change to files using these packages.
Additionally, this contains several updates to the `package-lock.json` file as a result of running `npm audit fix`.
See #54727.
git-svn-id: https://develop.svn.wordpress.org/trunk@53113 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that the value get parameter `_embed ` that is passed to the `envelope_response` method, is run through the `rest_parse_embed_param` function.
Props Spacedmonkey, johnbillion, TimothyBlynJacobs.
Fixes#54015.
git-svn-id: https://develop.svn.wordpress.org/trunk@53110 602fd350-edb4-49c9-b593-d223f7449a82
Permit plugin authors to pass the menu position as a float in `add_menu_page()` and `add_submenu_page()`. This allows for a common practice within major plugins to avoid menu collisions by passing a float.
Follow up to [52569].
Props justinbusa, dd32, welcher, SergeyBiryukov, kirtan95, audrasjb, Cybr, chaion07, costdev, peterwilsoncc.
See #40927.
git-svn-id: https://develop.svn.wordpress.org/trunk@53104 602fd350-edb4-49c9-b593-d223f7449a82
Improve cache key generation in the `WP_Network_Query` class by removing `update_network_cache` element in the array used to generate the cache key. This
element does not affect that cache and by removing it, it improves the likelihood of reusing an existing cache.
Props Spacedmonkey, furi3r, johnbillion, johnjamesjacoby, flixos90.
Fixes#55461.
git-svn-id: https://develop.svn.wordpress.org/trunk@53098 602fd350-edb4-49c9-b593-d223f7449a82
Improve cache key generation in the `WP_Site_Query` class by removing `update_site_cache` and `update_site_meta_cache` elements in the array used to generate
the cache key. These elements do not affect that cache and by removing them, improve the likelihood of reusing an existing cache.
Props Spacedmonkey, furi3r, johnbillion, johnjamesjacoby, flixos90.
Fixes#55462.
git-svn-id: https://develop.svn.wordpress.org/trunk@53097 602fd350-edb4-49c9-b593-d223f7449a82
Fixes the issue when you register blocks with `block.json` in your theme. There is no longer an assets's URL error because it resolves correctly in relation to the theme where it is located.
Props fabiankaegy, ocean90, whoisnegrello, audrasjb, peterwilsoncc,
Fixes#54647, #55513.
git-svn-id: https://develop.svn.wordpress.org/trunk@53091 602fd350-edb4-49c9-b593-d223f7449a82
Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.
Related changes in Gutenberg:
- Include individual serialization changes from 6de16981c7
- Skip Style Engine integration from 44925a947f%60
Props ramonopoly, aaronrobertshaw.
See #55505.
git-svn-id: https://develop.svn.wordpress.org/trunk@53076 602fd350-edb4-49c9-b593-d223f7449a82
This include the /global-styles/themes/{theme}/variations rest endpoint into core.
The endpoint will be used by the site editor to display alternative theme styles to the user.
Props gziolo, oandregal.
See #55505.
git-svn-id: https://develop.svn.wordpress.org/trunk@53072 602fd350-edb4-49c9-b593-d223f7449a82
In `redirect_guess_404_permalink()` search for posts using all publicly queryable statuses rather than limiting options to the `publish` status.
Props goaroundagain, costdev, htdat, audrasjb, chaion07.
Fixes#47911.
git-svn-id: https://develop.svn.wordpress.org/trunk@53043 602fd350-edb4-49c9-b593-d223f7449a82
Ensure the post cache is primed with raw sanitized data. This resolves an inconsistency between how posts retrieved via `get_post()` vs `WP_Query` are cached.
This prevents `sanitize_post( $post, 'raw' )` being run multiple times on a cached post. This can happen over 20 times per post on some page loads so avoiding this will provide a noticeable performance boost.
Props Cybr, SergeyBiryukov, peterwilsoncc, hellofromTonya, costdev.
Fixes#50567.
git-svn-id: https://develop.svn.wordpress.org/trunk@53042 602fd350-edb4-49c9-b593-d223f7449a82
Add a limit to the number of terms requested in taxonomy queries. This improves the performance of the query and the likelihood of hitting an existing term query cache.
Props Spacedmonkey, peterwilsoncc, flixos90.
Fixes#55360.
git-svn-id: https://develop.svn.wordpress.org/trunk@53037 602fd350-edb4-49c9-b593-d223f7449a82
Improve performance of the `wp_count_comments` function by replacing a complex query with multiple calls to the `get_comments` function. Passing the `count` parameter to the `get_comments` function results in a simple
count query that returns quickly. Using `get_comments` also means that query is cached and run through filters.
Props FolioVision, markjaquith, nacin, ryan, coffee2code, wonderboymusic, ComputerGuru, jb510, SergeyBiryukov, Znuff, Rahe, uday17035, spacedmonkey, peterwilsoncc.
Fixes#19901.
git-svn-id: https://develop.svn.wordpress.org/trunk@53036 602fd350-edb4-49c9-b593-d223f7449a82
This filter allows modifying individual `img` tags within a blob of content that are by default processed by the `wp_filter_content_tags()` function. The addition of this filter facilitates plugins that tweak images to accomplish this goal without re-implementing duplicate content image parser logic, which furthermore can have a negative performance impact due to additional regular expressions.
In addition to the filterable `img` tag, the filter receives the context (typically the function or filter in which the content is parsed) and the attachment ID. The latter may be 0, in case the image is not an attachment (for example when it is an external image URL).
Props adamsilverstein, flixos90, pbearne, peterwilsoncc.
Fixes#55347.
git-svn-id: https://develop.svn.wordpress.org/trunk@53028 602fd350-edb4-49c9-b593-d223f7449a82
Migrate the alternative text, title, description, and caption of an image over to the cropped copy of the image after cropping. Ensure that characteristics added to an image prior to cropping are not lost.
Props flixos90, Clorith, afercia, antonvlasenko, ironprogrammer, hellofromTonya.
Fixes#37750.
git-svn-id: https://develop.svn.wordpress.org/trunk@53027 602fd350-edb4-49c9-b593-d223f7449a82
Currently in WordPress multisite there is a concept of large networks. The function `wp_is_large_network` is used to determine if a network has a large number of sites or users. If a network is marked as large, then
expensive queries to calculate user counts are not run on page load but deferred to scheduled events. However there are a number of places in a single site installation where this functionality would also be useful, as
expensive calls to count users and roles can make screens in the admin extremely slow.
In this change, the `get_user_count` function and related functionality around it is ported to be available in a single site context. This means that expensive calls to the `count_users` function are replaced with
calls to `get_user_count`. This change also includes a new function called `wp_is_large_user_count` and a filter of the same name, to mark if a site is large.
Props johnbillion, Spacedmonkey, Mista-Flo, lumpysimon, tharsheblows, obenland, miss_jwo, jrchamp, flixos90, macbookandrew, pento, desrosj, johnjamesjacoby, jb510, davidbaumwald, costdev.
Fixes#38741.
git-svn-id: https://develop.svn.wordpress.org/trunk@53011 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that the `posts_per_page` parameter submit to sticky post query matches the number of sticky posts requested.
Follow-up to [52982]
Props Spacedmonkey, peterwilsoncc.
See #36907.
git-svn-id: https://develop.svn.wordpress.org/trunk@52990 602fd350-edb4-49c9-b593-d223f7449a82
Reorder the parameters of the `get_posts()` call for consistency with similar calls elsewhere.
Follow-up to [52982].
See #36907.
git-svn-id: https://develop.svn.wordpress.org/trunk@52985 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that the parameters `update_post_meta_cache`, `update_post_term_cache`, `cache_results`, `suppress_filters` and
`lazy_load_term_meta` that are passed to WP_Query, are also passed down to the secondary query used to get sticky
posts.
Props Spacedmonkey, peterwilsoncc, rehanali, uday17035.
Fixes#36907.
git-svn-id: https://develop.svn.wordpress.org/trunk@52982 602fd350-edb4-49c9-b593-d223f7449a82
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.
Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes#38913.
See #39176.
git-svn-id: https://develop.svn.wordpress.org/trunk@52978 602fd350-edb4-49c9-b593-d223f7449a82
After the comment cache group was made persistent in [37613], also make
persistent in object-cache.php used for PHPUnit tests.
See #54725
git-svn-id: https://develop.svn.wordpress.org/trunk@52976 602fd350-edb4-49c9-b593-d223f7449a82
Increase the number of cache hits in `WP_Term_Query` by normalizing data included in the cache key.
Arguments that do not affect the SQL query, eg `update_term_meta_cache`, are removed from cache key generation. Arguments that are accepted in multiple formats, eg a string and an array, are normalized for both the cache key and the SQL query.
Props spacedmonkey.
Fixes#55352.
git-svn-id: https://develop.svn.wordpress.org/trunk@52970 602fd350-edb4-49c9-b593-d223f7449a82
`<ruby>` element and its friends are used to attach annotation text onto a piece of text. This is especially commonly used in Japanese content, but it can also been seen in content of other languages like Chinese.
The set of elements to enable such functionality consists of `<ruby>`, `<rt>`, and `<rp>` in the [https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element HTML Standard], while some browsers (like Firefox) additionally support `<rb>` and `<rtc>` for more advanced formatting, which are not yet included in the official HTML spec, but can be found in a [https://www.w3.org/TR/html-ruby-extensions/ W3C extension].
Props upsuper, mukesh27, SergeyBiryukov.
Fixes#54698.
git-svn-id: https://develop.svn.wordpress.org/trunk@52969 602fd350-edb4-49c9-b593-d223f7449a82
Globally permit the `lang`, `xml:lang`, and `dir` attributes on all elements rather than a subset in accordance with the HTML specification.
Props upsuper, SergeyBiryukov, mukesh27, audrasjb.
Fixes#54699.
git-svn-id: https://develop.svn.wordpress.org/trunk@52968 602fd350-edb4-49c9-b593-d223f7449a82
This makes its signature more correct by implementing the spread operator, and adjusts the internal logic correspondingly without affecting performance.
Props jrf, SergeyBiryukov, davidbaumwald, mauriac, johnbillion
Fixes#53218
git-svn-id: https://develop.svn.wordpress.org/trunk@52952 602fd350-edb4-49c9-b593-d223f7449a82
Adds a new `WP_Block_Editor_Context::$name` and field. This allows plugin
developers to tell which block editor is being loaded when using filters such as
`allowed_block_types_all` and `block_editor_rest_api_preload_paths`.
Fixes#55301.
Props talldanwp, gziolo, andraganescu.
git-svn-id: https://develop.svn.wordpress.org/trunk@52942 602fd350-edb4-49c9-b593-d223f7449a82
Test `wp_set_term_objects()` using terms with special characters in the name, for example ampersand, bullet and other symbols and punctuation.
Props kapacity, costdev.
Fixes#53152.
See #54725.
git-svn-id: https://develop.svn.wordpress.org/trunk@52938 602fd350-edb4-49c9-b593-d223f7449a82
For `wp.i18n` the library [https://github.com/messageformat/Jed Jed] was initially used which was throwing an error if a domain was not registered but used in a translate function. Later, the library was replaced by [https://github.com/aduth/tannin Tannin] which no longer requires the domain to be registered and thus we can avoid printing an empty-ish translations script that doesn't add any translations.
Props jsnajdr.
Fixes#55250.
git-svn-id: https://develop.svn.wordpress.org/trunk@52937 602fd350-edb4-49c9-b593-d223f7449a82
A new function `wp_filesize()` was added with [52837]. The function lived in the `wp-admin/includes/file.php` file. However, this admin specific function is not loaded into memory when hitting `media/edit` endpoint. The result was a `500` Internal Server Error. Why? The function is invoked with that endpoint, but the function does not exist in memory.
This commit relocates the new function to the `wp-includes/functions.php` file. In doing so, the function is available for both the frontend and backend.
Follow-up to [52837].
Props talldanwp, spacedmonkey, costdev, antonvlasenko.
Fixes#55367.
git-svn-id: https://develop.svn.wordpress.org/trunk@52932 602fd350-edb4-49c9-b593-d223f7449a82
Replace raw SQL queries to the terms table, with a call to the `get_terms` function. Using `get_terms` means that `term_exists` is now cached. For developers using `term_exists` where cache invalidation is disabled, such as importing, a workaround was added to ensure that queries are uncached.
Props Spacedmonkey, boonebgorges, flixos90, peterwilsoncc.
Fixes#36949.
git-svn-id: https://develop.svn.wordpress.org/trunk@52921 602fd350-edb4-49c9-b593-d223f7449a82
Adds an end-to-end (e2e) test case for:
* Emptying a post from the trash.
* Restoring a post from the trash.
Props pavanpatil1, pooja1210, justinahinon, kevin940726.
Fixes#54843.
git-svn-id: https://develop.svn.wordpress.org/trunk@52839 602fd350-edb4-49c9-b593-d223f7449a82
Store the file size of all newly uploaded attachments, as part of the metadata stored in post meta. Storing file size means, developers will not have to resort to doing `filesize` function calls, that can be time consuming on assets on offloaded to services like Amazon’s S3.
This change also introduces a new helper function called, `wp_filesize`. This is a wrapper around the `filesize` php function, that adds some helpful filters and ensures the return value is an integer.
Props Cybr, Spacedmonkey, SergeyBiryukov, johnwatkins0, swissspidy, desrosj, joemcgill, azaozz, antpb, adamsilverstein, uday17035.
Fixes#49412.
git-svn-id: https://develop.svn.wordpress.org/trunk@52837 602fd350-edb4-49c9-b593-d223f7449a82
The query cache currently implemented in `WP_Term_Query` caches the final output of the query, depending on what fields are requested. This is wasteful, as if a user requests `fields` => `all`, then an unlimited array of `WP_Term` objects could be stored in the object cache. Instead of storing the whole WP_Term object, this change only the term_id is stored. To get an array the full WP_Term objects, the `_prime_term_caches` function is called with an array of ids. In instances where a persistent object cache is not in use, then this will result in another SQL query to be run. After `_prime_term_caches` is called if this term is requested again in the same page load, then it will already be loaded into memory. If a user runs `WP_Term_Query` with the fields param set to `all_with_object_id`, an array of objects containing both the term_id and object_ids are stored in cache.
This change also improves the logic to load term meta caches. This change ensures that term meta is always primed for all terms loaded in the term query.
Props Spacedmonkey, boonebgorges, jbpaul17, peterwilsoncc, flixos90, pbearne.
Fixes#37189.
git-svn-id: https://develop.svn.wordpress.org/trunk@52836 602fd350-edb4-49c9-b593-d223f7449a82