Returning a non-null value from the new `posts_pre_query` filter will cause
`WP_Query` to skip its database query, so that posts data can be provided from
elsewhere. This is useful in cases where post data may be mirrored in a
separate location, such as an external search application.
Developers should note that the `WP_Query` properties generally used to
calculate pagination - specifically, `found_posts` and `max_num_pages`, which
are determined by default in `set_found_posts()` - must be provided explicitly
when using the `posts_pre_query` filter; since `WP_Query` will not be
contacting the database, it will have no access to `SELECT FOUND_ROWS()`.
The `WP_Query` instance is passed to `posts_pre_query` by reference, so that
these properties can be set manually if needed.
Props jpdavoutian, tlovett1.
Fixes#36687.
git-svn-id: https://develop.svn.wordpress.org/trunk@37692 602fd350-edb4-49c9-b593-d223f7449a82
These adjustments improve the documentation for the filters and adjust the names make them more consistent with other filters already in core.
See #34936.
Props DrewAPicture, ocean90, jorbin
git-svn-id: https://develop.svn.wordpress.org/trunk@37690 602fd350-edb4-49c9-b593-d223f7449a82
First-order meta query clauses are defined as clauses that have either a 'key' or 'value' array key. When using named first-order clauses in meta queries to order results in the parent query, `WP_Meta_Query` can additionally accept first-order clauses at the sub-clause level, which was not previous documented.
Fixes#32659.
git-svn-id: https://develop.svn.wordpress.org/trunk@37688 602fd350-edb4-49c9-b593-d223f7449a82
This brings `Language_Pack_Upgrader` in line with the core, theme, and plugin upgrader.
Props ronalfy.
Fixes#36872.
git-svn-id: https://develop.svn.wordpress.org/trunk@37687 602fd350-edb4-49c9-b593-d223f7449a82
`wp_get_canonical_url()` encapsulates the URL logic of `rel_canonical()` to provide a consistent way to retrieve the canonical URL for a post.
The new filter `get_canonical_url` allows to customize the canonical URL.
Props joostdevalk, jipmoors, DrewAPicture, ocean90.
Fixes#36168.
git-svn-id: https://develop.svn.wordpress.org/trunk@37685 602fd350-edb4-49c9-b593-d223f7449a82
Allows the fetching of terms based on `term_taxonomy_id`, or an array of
`term_taxonomy_ids`.
Props spacedmonkey.
Fixes#37074.
git-svn-id: https://develop.svn.wordpress.org/trunk@37683 602fd350-edb4-49c9-b593-d223f7449a82
The `?tab=upload` page still exists for no-js support and for users who may
access it directly (e.g. from bookmarks or history) or plugins doing the same.
In this page, the "Browse plugins" link should always behave like a link.
Fixes#35429.
git-svn-id: https://develop.svn.wordpress.org/trunk@37681 602fd350-edb4-49c9-b593-d223f7449a82
Avoid references to "visual" positions in favour of positions in the document
structure. The help text shouldn't assume users can see.
Also, in the Posts screen don't mention specific types of posts and use a more
generic text instead.
Props odysseygate, pansotdev, zakb8.
Fixes#34761.
git-svn-id: https://develop.svn.wordpress.org/trunk@37680 602fd350-edb4-49c9-b593-d223f7449a82
For Web standards and accessibility, always prefer native controls instead of
`span` or `div` elements.
Fixes#36903.
git-svn-id: https://develop.svn.wordpress.org/trunk@37679 602fd350-edb4-49c9-b593-d223f7449a82
This switches event binding in `wp.media.controller.EditImage` to use `on`
instead of `listenTo` to restore rendering of the correct toolbar when the
`toolbar:render:edit-image` event fires. The existing listeners broke
when we upgraded Backbone in [36546].
Props adamsilverstein.
Fixes#36861 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@37678 602fd350-edb4-49c9-b593-d223f7449a82
Moving to load.php introduces parity with other commonly evaluated `is_*()` functions such as `is_admin()` or `is_multisite()`. It also makes `is_ssl()` available much earlier in the loading process, such as for use in drop-ins like advanced-cache.php.
Props johnjamesjacoby.
Fixes#35844.
git-svn-id: https://develop.svn.wordpress.org/trunk@37677 602fd350-edb4-49c9-b593-d223f7449a82
`_wp_upload_dir_baseurl()` is a private function introduced in 4.4
as part of the "responsive images" feature. It was for runtime
caching of the URL to the uploads directory. It is deprecated in
4.5 with the introduction of `wp_get_upload_dir()`.
Outside core, it's only used as part of a back-compat shim in the
original feature plugin for responsive images (ricg-responsive-images),
which includes its own version of the function definition, so it's
safe to remove from core.
Fixes#36375.
git-svn-id: https://develop.svn.wordpress.org/trunk@37676 602fd350-edb4-49c9-b593-d223f7449a82
* Make codex URL and accessibility text separate strings.
* Add translator comments.
Props ramiy for initial patch.
Fixes#35721.
git-svn-id: https://develop.svn.wordpress.org/trunk@37675 602fd350-edb4-49c9-b593-d223f7449a82
Replaces unsecure links in documentation and translator comments with their secure versions.
Props johnpgreen, netweb
Fixes#36993
git-svn-id: https://develop.svn.wordpress.org/trunk@37674 602fd350-edb4-49c9-b593-d223f7449a82
Similar to `get_current_blog_id`, this can be used to get the ID of the `$current_site` global. If not available, it will fallback to the main network ID. In single site, this will return 1.
Props spacedmonkey, flixos90.
Fixes#33900.
git-svn-id: https://develop.svn.wordpress.org/trunk@37670 602fd350-edb4-49c9-b593-d223f7449a82
Covers:
* Currency signs
* Decompositions for Latin-1 Supplement
* Decompositions for Latin Extended-A
* Decompositions for Latin Extended-B
* Vowels with diacritic (Chinese, Hanyu Pinyin)
* Characters replaced for the `de_DE`, `de_DE_formal`, and `da_DK` locales
Props john_schlick for the initial work.
Props DrewAPicture, ocean90.
See #34677.
git-svn-id: https://develop.svn.wordpress.org/trunk@37669 602fd350-edb4-49c9-b593-d223f7449a82
When an object with private properties is cast directly to an array, those properties are no longer available with their original keys.
Props @flixos90.
See #36717.
git-svn-id: https://develop.svn.wordpress.org/trunk@37667 602fd350-edb4-49c9-b593-d223f7449a82
* One test per method
* Clarify existing tests.
* Add test for passing a "blog slug" string to `get_blog_details()`.
* Shared fixture of sites.
* Reduce number of sites created to only those necessary.
* Remove unnecessary networks creation.
See #36566.
git-svn-id: https://develop.svn.wordpress.org/trunk@37666 602fd350-edb4-49c9-b593-d223f7449a82
Within the Ajax action `_wp_ajax_delete_comment_response()` if the comment_type query var is set, fallback to the previous `$total - 1` value instead of getting an incorrect value from `wp_comment_count()`.
Fixes#36991.
git-svn-id: https://develop.svn.wordpress.org/trunk@37664 602fd350-edb4-49c9-b593-d223f7449a82
Adds the keyboard navigation query vars to `wp_removable_query_args()` and passes the results of said function to remove_query_var() inside the WP_List_Table pagination method.
Props EFAREM for the initial patch.
Fixes#35620.
git-svn-id: https://develop.svn.wordpress.org/trunk@37663 602fd350-edb4-49c9-b593-d223f7449a82
* Convert existing tests into a data provider and clarify expectations.
* Add shared test fixtures in preparation for future tests.
This passes with the `wp_get_sites()` from 4.5 and the deprecated version in trunk.
See #36566.
git-svn-id: https://develop.svn.wordpress.org/trunk@37662 602fd350-edb4-49c9-b593-d223f7449a82
* Add magic `__get()`, `__set()`, and `__isset()` methods to `WP_Site` and `WP_Network.
* Provide `(int) $network->site_id` for `(string) $network->blog_id`
* Provide `(int) $site->id` for `(string) $site->blog_id`
* Provide `(int) $site->network_id` for `(string) $site->site_id`
Props flixos90, jeremyfelt.
Fixes#36717.
git-svn-id: https://develop.svn.wordpress.org/trunk@37657 602fd350-edb4-49c9-b593-d223f7449a82
`get_term_by()` always returns a single term, even when more than one term
matches the query parameters. The new note warns developers to use
`get_terms()` when such ambiguity may result.
Fixes#36878.
git-svn-id: https://develop.svn.wordpress.org/trunk@37656 602fd350-edb4-49c9-b593-d223f7449a82
When custom pagination parameters are passed to `wp_list_comments()`, a
secondary query must be performed to fetch the proper comments. See [36157].
This query should show comments of the same `comment_status` as the default
query initialized in `comments_template()`: show only comments that are
approved, or those that are unapproved but belong to the current user.
Props smerriman.
Fixes#37048.
git-svn-id: https://develop.svn.wordpress.org/trunk@37655 602fd350-edb4-49c9-b593-d223f7449a82
To ensure a clean run, the test suite drops all tables before installing, by simply looping over the table list and dropping them if they exist. This works well for Core, but may fail when a plugin has created a table with foreign key constraints in a previous test run.
Many plugins choose to base their test suite on the Core setup, so making life easier for them is a plus, even if Core doesn't directly need this change.
Props javorszky.
Fixes#37046.
git-svn-id: https://develop.svn.wordpress.org/trunk@37654 602fd350-edb4-49c9-b593-d223f7449a82
Defer to the new `get_sites()` replacement, offering fresh (...or cached) `WP_Site` objects via the new `WP_Site_Query`.
Props flixos90.
Fixes#36994.
git-svn-id: https://develop.svn.wordpress.org/trunk@37653 602fd350-edb4-49c9-b593-d223f7449a82
Full `WP_Site` objects should be expected from `get_site()` rather than arrays.
In the single (soon to be deprecated) use of arrays for this in core, we can cast the result to `(array)` for back-compat.
See #35791.
git-svn-id: https://develop.svn.wordpress.org/trunk@37652 602fd350-edb4-49c9-b593-d223f7449a82
Whenever package.json or Gruntfile.js is updated, we should assume that it affects everything and run the full monty of tasks.
Fixes#36528.
Props iseulde.
git-svn-id: https://develop.svn.wordpress.org/trunk@37650 602fd350-edb4-49c9-b593-d223f7449a82
`term_id` and `term_taxonomy_id` become offset when running the entire test
suite.
Introduced in [37647].
See #37009.
git-svn-id: https://develop.svn.wordpress.org/trunk@37649 602fd350-edb4-49c9-b593-d223f7449a82
The change can cause fatal errors under certain conditions, like when the subclass has a different function signature for `widget()` or doesn't even implement the method.
See #35981.
git-svn-id: https://develop.svn.wordpress.org/trunk@37648 602fd350-edb4-49c9-b593-d223f7449a82
Move the REST API JSONP callback validation check into a separate function named `wp_check_jsonp_callback()`. This allows plugins to use the built-in validation when handling JSONP callbacks.
Extremely Important Note: If you send JSONP in your custom response, make sure you prefix the response with `/**/`. This will mitigate the Rosetta Flash exploit. You should also send the `X-Content-Type-Options:nosniff` header, or even better, use the REST API infrastructure.
Props rmccue.
Fixes#28523.
git-svn-id: https://develop.svn.wordpress.org/trunk@37646 602fd350-edb4-49c9-b593-d223f7449a82