This filter allows developers to modify the output of `get_page_of_comment()`.
As a side effect of this new filter, comment page numbers will always be
returned as integers. Previously, they would sometimes be returned as floats -
eg `float(2.0)` instead of `int(2)`.
Props laceous.
See #13939.
git-svn-id: https://develop.svn.wordpress.org/trunk@34808 602fd350-edb4-49c9-b593-d223f7449a82
The function now uses the following order of precedence when calculating
comment pagination: 1. the 'per_page' value passed in the `$args` array,
2. the 'comments_per_page' query var in `$wp_query`, and 3. the
'comments_per_page' setting from options-discussion.php. This change allows
`get_page_of_comment()` to return an accurate value before the main query
has been run.
Props laceous.
See #13939.
git-svn-id: https://develop.svn.wordpress.org/trunk@34806 602fd350-edb4-49c9-b593-d223f7449a82
This prevents notices from being thrown when a 'pre_get_users' callback
removes required values from the list of `query_vars`.
For backward compatibility with previous uses of 'pre_get_users', default
values are parsed both before and after the action is fired.
Fixes#33449.
git-svn-id: https://develop.svn.wordpress.org/trunk@34804 602fd350-edb4-49c9-b593-d223f7449a82
This is consistent with page and taxonomy templates, which support slugs as well.
Props ericjuden, johnbillion.
Fixes#18859.
git-svn-id: https://develop.svn.wordpress.org/trunk@34800 602fd350-edb4-49c9-b593-d223f7449a82
The current list table is passed as a second parameter, `$this`, and can take the form of either a `WP_Users_List_Table` or `WP_MS_Users_List_Table` instance depending on the context in which the filter was evaluated.
Props juliobox for the initial patch.
Fixes#25360.
git-svn-id: https://develop.svn.wordpress.org/trunk@34796 602fd350-edb4-49c9-b593-d223f7449a82
Instead of using `Array.toString()` to serialize an array with comma delimiters, explicitly `join` the array using spaces instead. Also ensure that `xfn` is handled properly if it ever gets stored as an array.
Props tyxla, westonruter.
Fixes#34111.
git-svn-id: https://develop.svn.wordpress.org/trunk@34788 602fd350-edb4-49c9-b593-d223f7449a82
* Corrects phrasing used in the descriptions for and filters in `_n()` and `_nx()`, particularly with regard to the use of 'singular' instead of 'single' or '1', and 'plural' instead of 'not 1'.
* Adds example usage to `_n()`, `_nx()`, `_nx_noop()`, and `translate_nooped_plural()`.
* Adds hash notation `@return` doc for `_n_noop()` and `_nx_noop()`.
* Adds missing default values for the optional `$domain` parameter in several places.
Props johnbillion.
Fixes#34127.
git-svn-id: https://develop.svn.wordpress.org/trunk@34781 602fd350-edb4-49c9-b593-d223f7449a82
Replaces all uses of `*_site_option()` with the corresponding "network" function.
This excludes one usage in `wp-admin/admin-footer.php` that needs more investigation.
Props spacedmonkey.
See #28290.
git-svn-id: https://develop.svn.wordpress.org/trunk@34778 602fd350-edb4-49c9-b593-d223f7449a82
Introduces `add_network_option()`, `update_network_option()`, `get_network_option()`, and `delete_network_option()`, which use the internals previously found in the `*_site_option()` functions and allow for a network ID to enable cross network storage and retrieval of network options.
* `*_site_option()` functions are now wrappers for `*_network_option()` and will interact with options for the current network in a multisite environment.
* All will continue to fallback to `*_option()` for non-multisite uses.
* Adds basic tests for cross network storage and retrieval.
* Existing tests for `*_site_option()` functions provide coverage for storage and retrieval of current network options.
Props spacedmonkey, DrewAPicture, jeremyfelt.
See #28290.
git-svn-id: https://develop.svn.wordpress.org/trunk@34777 602fd350-edb4-49c9-b593-d223f7449a82
This hook can be leveraged both for the legacy menus interface and the menus integration in the Customizer, as both use the containing function, `wp_update_nav_menu_item()`.
Props MikeHansenMe, tyxla.
Fixes#30983.
git-svn-id: https://develop.svn.wordpress.org/trunk@34769 602fd350-edb4-49c9-b593-d223f7449a82
If the `$action` type is 'query_plugins' or 'plugin_information', the API will return an object, thus an object should be passed if replacing it. For 'hot_tags' and 'hot_categories', the same logic applies, but with arrays instead.
See #34035.
git-svn-id: https://develop.svn.wordpress.org/trunk@34763 602fd350-edb4-49c9-b593-d223f7449a82
* Move pattern from `wptexturize()` into a separate function.
* Move pattern from `wp_html_split()` into a separate function.
* Beautify code for `wp_html_split()`.
* Remove unnecessary instances of `/s` modifier in patterns that don't use dots.
* Add `tests/phpunit/data/formatting/whole-posts.php` for testing larger strings.
* Add function `benchmark_pcre_backtracking()`.
* Add tests for `wp_html_split()`.
* Add tests for `wptexturize()`.
* Add tests for `get_shortcode_regex()`.
Props miqrogroove.
Fixes#34121.
git-svn-id: https://develop.svn.wordpress.org/trunk@34761 602fd350-edb4-49c9-b593-d223f7449a82
This todo has been in place since the original merge of MU. At the time of merge, `wpmu_protect_special_option()` protected an empty array, and there has been no noticeable need since. As we introduce `_network_option()`, let's leave this behind. A new ticket can be opened if necessary.
See #28290.
git-svn-id: https://develop.svn.wordpress.org/trunk@34756 602fd350-edb4-49c9-b593-d223f7449a82
`wp_update_plugins()` and `wp_update_themes()` are both hooked into `upgrader_process_complete` with priority 10. But at this stage the caches in `get_plugins()`, `search_theme_directories()`, and `wp_get_themes()` aren't refreshed yet so both functions couldn't fetch any translations for the new plugin/theme.
To reset the caches `wp_clean_themes_cache()` and `wp_clean_plugins_cache()` are now hooked into `upgrader_process_complete` with priority 9.
Fixes#34029.
git-svn-id: https://develop.svn.wordpress.org/trunk@34751 602fd350-edb4-49c9-b593-d223f7449a82
Reverts a portion of [34289] and leaves the render for the column behind. A plugin can register these fields for display via filter.
Fixes#18661.
git-svn-id: https://develop.svn.wordpress.org/trunk@34750 602fd350-edb4-49c9-b593-d223f7449a82
The main site on a new network is forced by default into using `/blog` as the prefix for its permalink structure. This can be changed easily through the network admin, though the `options-permalink.php` screen is then unusable to make further changes to the structure.
Now, if `/blog/` is not at the beginning of the `permalink_structure` option, we do not force `/blog` as a prefix in the UI.
Fixes#12002.
git-svn-id: https://develop.svn.wordpress.org/trunk@34749 602fd350-edb4-49c9-b593-d223f7449a82
Also, add a "Edit Comment" legend before the Quick Edit form to pair it with "Reply to Comment" and "Add new Comment" and move the Name, Email, and URL fields after the Comment textarea.
Props joedolson, afercia.
Fixes#33757.
git-svn-id: https://develop.svn.wordpress.org/trunk@34743 602fd350-edb4-49c9-b593-d223f7449a82
The call to `flock()` is an exclusive advisory lock, which in my testing only PHP respects (apache continues to read it).
Not all filesystems support locking (remote NFS mounts for example) so this offers minimal benefit to those platforms, but offers much better protection against file corruption on systems which do support it.
The call is blocking, so a second process will wait for the first to complete before writing if supported.
See #31767
git-svn-id: https://develop.svn.wordpress.org/trunk@34740 602fd350-edb4-49c9-b593-d223f7449a82
This fixes issues where SSH2 with chrooted environments runs into a `Unable to locate WordPress Content directory (wp-content).` error.
The workaround is to simply list the contents of the `/./` directory instead of `/`.
Fixes#33919
git-svn-id: https://develop.svn.wordpress.org/trunk@34738 602fd350-edb4-49c9-b593-d223f7449a82
Specifically, `::insert()`, `::replace()`, `::update()`, and `::delete()` can now set a column to `NULL`, or add the `IS NULL` condition to the `WHERE` clause.
This is based on [backpress 279].
Props pento, nbachiyski, sorich87.
Fixes#15158.
git-svn-id: https://develop.svn.wordpress.org/trunk@34737 602fd350-edb4-49c9-b593-d223f7449a82
After [34561], `wp_list_comments()` no longer passed all of a post's comments
to `Walker_Comments`. As a result, calls to `get_comment_link()` occurring
inside the comment loop had insufficient context to determine the proper
'cpage' value to use when generating comment permalinks. This, in turn, caused
comment permalinks to behave erratically.
The current changeset addresses the problem as follows:
* `get_comment_link()` now accepts a 'cpage' parameter. When present, 'cpage' will be used to build the comment permalink - no automatic calculation will take place.
* When called within the main loop, `wp_list_comments()` calculates the proper 'cpage' value for comments in the loop, and passes it down to `get_comment_link()`.
* `cpage` and `comment-page-x` query vars are generally required in comment permalinks (see #34068), but an exception is made when 'default_comment_page=oldest': the bare post permalink will always be the same as `cpage=1`, so `cpage` is excluded in this case.
Props peterwilsoncc for assiduous spreadsheeting.
Fixes#34073.
git-svn-id: https://develop.svn.wordpress.org/trunk@34735 602fd350-edb4-49c9-b593-d223f7449a82
This change causes it to list the parent directories files, and assets that the node exists within the returned listing, this is a little more compatible than relying upon the FTP server to correctly filter the returned resultset to the specific file/node being requested.
Fixes#28013
git-svn-id: https://develop.svn.wordpress.org/trunk@34733 602fd350-edb4-49c9-b593-d223f7449a82
`WP_Comment_Query::fill_descendants()` queries for a comment tree in a way that
minimizes database overhead, and places the located descendants with their
proper parents. However, it doesn't touch leaf nodes - comments with no
children - so future calls to `get_children()` on those comment objects
result in unnecessary database queries. To prevent this, `fill_descendants()`
now sets a `populated_children` flag on all located `WP_Comment` objects.
See #8071.
git-svn-id: https://develop.svn.wordpress.org/trunk@34730 602fd350-edb4-49c9-b593-d223f7449a82
[34561] "fixed" the problem of newest-first comments showing fewer than
'per_page' comments on the post permalink when the total number of comments
was not divisible by 'per_page'. See #29462. But this fix caused numerous
other problems. First, comment pages reported by `get_page_of_comment()`
(which expects comment pages to be filled oldest-first) were no longer correct.
Second, and more seriously, the new logic caused comments to be shifted
between pages, making their permalinks non-permanent.
The current changeset reverts the changed behavior. In order to preserve the
performance improvements introduced in [34561], an additional query must be
performed when 'default_comments_page=newest' and 'cpage=0' (ie, you're viewing
the post permalink). A nice side effect of this revert is that we no longer
need the hacks required to determine proper comment pagination, introduced in
[34561].
See #8071. See #34073.
git-svn-id: https://develop.svn.wordpress.org/trunk@34729 602fd350-edb4-49c9-b593-d223f7449a82
Add 2 methods to `WP_List_Table`, `->get_orderby()` and `->get_order()`. Override the methods in `WP_Posts_List_Table`.
`WP_Posts_List_Table` calls `wp_edit_posts_query()` in `->prepare_items()` which is a wrapper for `wp()`. As such, we can obtain `orderby` and `order` via `get_query_var()`, instead of the URL.
Fixes#25493.
git-svn-id: https://develop.svn.wordpress.org/trunk@34728 602fd350-edb4-49c9-b593-d223f7449a82
Previously, it was necessary to explain in a double-negative that `$richedit` being false would prevent `$content` from being passed through `esc_textarea()`. The updated `$rich_edit` name and documentation now better reflects the intent of the parameter.
Fixes#21613.
git-svn-id: https://develop.svn.wordpress.org/trunk@34727 602fd350-edb4-49c9-b593-d223f7449a82
If trash is disabled, they wil continue to go into spam like they do now.
props wonderboymusic, solarissmoke, MikeHansenMe.
fixes#7051.
git-svn-id: https://develop.svn.wordpress.org/trunk@34726 602fd350-edb4-49c9-b593-d223f7449a82
Using the same `$post_new_file` global variable name in `wp-admin/menu.php` in [33723] was unintentional, but we're already unsetting other variables that are in global scope so we can just unset this one as well. Someday the admin menu won't be a big pile of sad and cryptic globals. Maybe.
props johnjamesjacoby, norcross.
fixes#34045.
git-svn-id: https://develop.svn.wordpress.org/trunk@34723 602fd350-edb4-49c9-b593-d223f7449a82
Fixes CSS selector to match what is being used for the "Add Widget" button in the customizer.
Props umesh.nevase.
Fixes#34102.
git-svn-id: https://develop.svn.wordpress.org/trunk@34721 602fd350-edb4-49c9-b593-d223f7449a82
Termmeta cache priming was throwing database errors on installations that had
not yet gone through the database update routine. To avoid errors in all cases,
the check has been added to all termmeta functions. These checks will be
removed in a future version of WordPress. (Hang on to your hats!)
Fixes#34091.
git-svn-id: https://develop.svn.wordpress.org/trunk@34718 602fd350-edb4-49c9-b593-d223f7449a82
The addition of these new arguments brings `get_the_post_navigation()` into argument parity with `get_previous_post_link()` and `get_next_post_link()`, both of which it wraps, and will allow for more flexibility in configuring the next and previous post links for simultaneous display in themes.
Props ChaseWiseman.
Fixes#32618.
git-svn-id: https://develop.svn.wordpress.org/trunk@34715 602fd350-edb4-49c9-b593-d223f7449a82
Lazy-loading logic is moved to a method on `WP_Query`. This makes it possible
for comment feeds to take advantage of metadata lazyloading, in addition to
comments loaded via `comments_template()`.
This new technique parallels the termmeta lazyloading technique introduced in
[34704].
Fixes#34047.
git-svn-id: https://develop.svn.wordpress.org/trunk@34711 602fd350-edb4-49c9-b593-d223f7449a82
[34529] introduced lazyloading for the metadata belonging to terms matching
posts in the main `WP_Query`. The current changeset improves this technique
in the following ways:
* Term meta lazyloading is now performed on the results of all `WP_Query` queries, not just the main query.
* Fewer global variable touches and greater encapsulation.
* The logic for looping through posts to identify terms is now only performed once per `WP_Query`.
Props dlh, boonebgorges.
See #34047.
git-svn-id: https://develop.svn.wordpress.org/trunk@34704 602fd350-edb4-49c9-b593-d223f7449a82
The 'exclude_tree' parameter must be compatible with 'hierarchical';
previously, 'hierarchical' canceled it out. This changeset also makes it so
that 'exclude_tree' is compatible with 'exclude'. When both are passed, and
'hierarchical' is true, the descendant trees of terms in both parameters will
be excluded from matched terms.
Props tott, webord, MikeHansenMe.
Fixes#12981.
git-svn-id: https://develop.svn.wordpress.org/trunk@34696 602fd350-edb4-49c9-b593-d223f7449a82
The 'name' argument (or the `WP_Screen` object if in the admin) can be used to help target specific instances of `wp_dropdown_users()` via this hook.
Props norcross.
See #19867.
git-svn-id: https://develop.svn.wordpress.org/trunk@34692 602fd350-edb4-49c9-b593-d223f7449a82
Previously, unattached attachments would have unsightly `/?attachment_id=1` URLs. As we've moved away from attachments being specifically attached to posts, instead being Media items, this has made the unattached URLs a more common occurrence.
We can breath easy once more, knowing that the world is a little bit safer from the horror of unnecessarily ugly URLs.
Props SergeyBiryukov, wonderboymusic, pento.
Fixes#1914.
git-svn-id: https://develop.svn.wordpress.org/trunk@34690 602fd350-edb4-49c9-b593-d223f7449a82
Using the same logic that we use to redirect posts when their slug changes, we can provide the same functionality for attachments. Attachment pages are posts, too.
Props swissspdy.
Fixes#34043.
git-svn-id: https://develop.svn.wordpress.org/trunk@34685 602fd350-edb4-49c9-b593-d223f7449a82