Commit Graph

1148 Commits

Author SHA1 Message Date
Weston Ruter 78b73c8906 Customizer: Defer embedding widget controls to improve DOM performance and initial load time.
The Menu Customizer feature includes a performance technique whereby the controls for nav menu items are only embedded into the DOM once the containing menu section is expanded. This commit implements the same DOM deferral for widgets but goes a step further than just embedding the controls once the widget area's Customizer section is expanded: it also defers the embedding of the widget control's form until the widget is expanded, at which point the `widget-added` event also fires to allow any additional widget initialization to be done. The deferred DOM embedding can speed up initial load time by 10x or more. This DOM deferral also yields a reduction in overall memory usage in the browser process.

Includes changes to `wp_widget_control()` to facilitate separating out the widget form from the surrounding accordion container; also includes unit tests for this previously-untested function. Also included are initial QUnit tests (finally) for widgets in the Customizer.

Fixes #33901.


git-svn-id: https://develop.svn.wordpress.org/trunk@34563 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 21:01:46 +00:00
Boone Gorges 0b7e8399b0 Force comment pagination on single posts.
Previously, the 'page_comments' toggle allowed users to disable comment
pagination. This toggle was only superficial, however. Even with
'page_comments' turned on, `comments_template()` loaded all of a post's
comments into memory, and passed them to `wp_list_comments()` and
`Walker_Comment`, the latter of which produced markup for only the
current page of comments. In other words, it was possible to enable
'page_comments', thereby showing only a subset of a post's comments on a given
page, but all comments continued to be loaded in the background. This technique
scaled poorly. Posts with hundreds or thousands of comments would load slowly,
or not at all, even when the 'comments_per_page' setting was set to a
reasonable number.

Recent changesets have addressed this problem through more efficient tree-
walking, better descendant caching, and more selective queries for top-level
post comments. The current changeset completes the project by addressing the
root issue: that loading a post causes all of its comments to be loaded too.

Here's the breakdown:

* Comment pagination is now forced. Setting 'page_comments' to false leads to evil things when you have many comments. If you want to avoid pagination, set 'comments_per_page' to something high.
* The 'page_comments' setting has been expunged from options-discussion.php, and from places in the codebase where it was referenced. For plugins relying on 'page_comments', we now force the value to `true` with a `pre_option` filter.
* `comments_template()` now queries for an appropriately small number of comments. Usually, this means the `comments_per_page` value.
* To preserve the current (odd) behavior for comment pagination links, some unholy hacks have been inserted into `comments_template()`. The ugliness is insulated in this function for backward compatibility and to minimize collateral damage. A side-effect is that, for certain settings of 'default_comments_page', up to 2x the value of `comments_per_page` might be fetched at a time.
* In support of these changes, a `$format` parameter has been added to `WP_Comment::get_children()`. This param allows you to request a flattened array of comment children, suitable for feeding into `Walker_Comment`.
* `WP_Query` loops are now informed about total available comment counts and comment pages by the `WP_Comment_Query` (`found_comments`, `max_num_pages`), instead of by `Walker_Comment`.

Aside from radical performance improvements in the case of a post with many
comments, this changeset fixes a bug that caused the first page of comments to
be partial (`found_comments` % `comments_per_page`), rather than the last, as
you'd expect.

Props boonebgorges, wonderboymusic.
Fixes #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34561 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 20:39:18 +00:00
Scott Taylor a9e30d8e94 XML-RPC: Introduce the concept of unit testing to `wp_xmlrpc_server::wp_newComment()`:
* Don't allow comments to be created for posts that have `comment_status` set to `'closed'`
* Set some magic props on `WP_User` to vars before passing them to `wp_xmlrpc_server::escape()`

Props wonderboymusic, jesin.
Fixes #27471.


git-svn-id: https://develop.svn.wordpress.org/trunk@34559 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 20:19:19 +00:00
Boone Gorges a6d1621736 Hierarchical comment query tests should be order-agnostic.
Travis-CI and other test environments can create weird race conditions.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34550 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:28:56 +00:00
Boone Gorges e1b44f5203 Introduce hierarchical query support to `WP_Comment_Query`.
Comments can be threaded. Now your query can be threaded too! Bonus: it's
not totally insane.

* The new `$hierarchical` parameter for `WP_Comment_Query` accepts three values:
  * `false` - Default value, and equivalent to current behavior. No descendants are fetched for matched comments.
  * `'flat'` - `WP_Comment_Query` will fetch the descendant tree for each comment matched by the query paramaters, and append them to the flat array of comments returned. Use this when you have a separate routine for constructing the tree - for example, when passing a list of comments to a `Walker` object.
  * `'threaded'` - `WP_Comment_Query` will fetch the descendant tree for each comment, and return it in a tree structure located in the `children` property of the `WP_Comment` objects.
* `WP_Comment` now has a few utility methods for fetching the descendant tree (`get_children()`), fetching a single direct descendant comment (`get_child()`), and adding anothing `WP_Comment` object as a direct descendant (`add_child()`). Note that `add_child()` only modifies the comment object - it does not touch the database.

Props boonebgorges, wonderboymusic.
See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34546 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 15:12:09 +00:00
Boone Gorges 8e955c4805 Improve pagination internals in `WP_Comment_Query`.
`WP_Comment_Query` will now report the total number of comments matching the
query params (`comments_found`), as well as the total number of pages required
to display these comments (`max_num_pages`). Because `SQL_CALC_FOUND_ROWS`
queries can introduce a lot of overhead in some cases, we disable the feature
by default. Pass `no_found_rows=false` to `WP_Comment_Query` to enable the
count. (We use the negative parameter name 'no_found_rows' for parity with
`WP_Query`.)

Props wonderboymusic, boonebgorges.
See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34544 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 14:34:20 +00:00
boonebgorges 4b83b005d2 Don't run `get_page_of_comment()` cache test on Multisite.
`get_page_of_comment()` uses `get_option()`, and WP_INSTALLING earlier in the
test suite causes `get_option()` to miss the cache. See #31130.

See #11334.

git-svn-id: https://develop.svn.wordpress.org/trunk@34540 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 13:54:02 +00:00
Boone Gorges a160be35b1 Bust term query cache when modifying term meta.
The 'last_changed' incrementor is used to invalidate the `get_terms()` query
cache. Since `get_terms()` queries may reference 'meta_query', changing term
metadata could change the results of the queries. So we invalidate the cache
on add, delete, and update.

See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34538 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 13:46:36 +00:00
Boone Gorges 7e44a2fef7 Use `WP_Comment_Query` in `get_page_of_comment()`.
This change allows `get_page_of_comment()` to use `WP_Comment_Query`'s native
caching mechanisms.

Props boonebgorges, Viper007Bond, wmertens, jeremyfelt.
Fixes #11334.

git-svn-id: https://develop.svn.wordpress.org/trunk@34535 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 05:10:40 +00:00
Boone Gorges 4da03f3cfc Allow metadata to be attached to comment at time of creation.
The new `$comment_meta` parameter of `wp_insert_comment()` allows an array of
key/value pairs to be passed when creating a comment. These pairs are then
stored as commentmeta when the comment has been created.

Props tellyworth, wonderboymusic.
Fixes #12431.

git-svn-id: https://develop.svn.wordpress.org/trunk@34533 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:40:30 +00:00
Boone Gorges 0dc1f270ec After [34529], fix multisite site creation test.
The test `Tests_Multisite_Site::test_created_site_details()` checks for tables
that should be empty on a newly created MS site. `termmeta` is now one of those
tables.

See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34532 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:31:52 +00:00
Boone Gorges 039955d5cd Introduce 'paged' parameter for `WP_User_Query`.
This is an alternative to using 'offset', and manually calculating pagination.
Note that 'paged' works only in conjunction with 'number', the latter of which
provides the per-page value.

Props sebastian.pisula.
Fixes #25145.

git-svn-id: https://develop.svn.wordpress.org/trunk@34531 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 04:25:20 +00:00
Boone Gorges 3425177325 Introduce metadata for taxonomy terms.
Adds a new table to the database schema (`wp_termmeta`), and a set of
`*_term_meta()` API functions. `get_terms()` and `wp_get_object_terms()`
now also support 'meta_query' parameters, with syntax identical to other
uses of `WP_Meta_Query`.

When fetching terms via `get_terms()` or `wp_get_object_terms()`, metadata for
matched terms is preloaded into the cache by default. Disable this behavior
by setting the new `$update_term_meta_cache` paramater to `false`.

To maximize performance, within `WP_Query` loops, the termmeta cache is *not*
primed by default. Instead, we use a lazy-loading technique: metadata for all
terms belonging to posts in the loop is loaded into the cache the first time
that `get_term_meta()` is called within the loop.

Props boonebgorges, sirzooro.
See #10142.

git-svn-id: https://develop.svn.wordpress.org/trunk@34529 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-25 03:58:59 +00:00
Scott Taylor 3e46dd8b92 Comments: In `get_comment_statuses()`, also return `trash`.
XML-RPC: In `wp_xmlrpc_server::wp_editComment()`, allow comments to be trashed.

Introduce unit tests for `wp_editComment` in `xmlrpc/*` #NeverForget

Props tyxla, wonderboymusic.
Fixes #30965.


git-svn-id: https://develop.svn.wordpress.org/trunk@34524 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:47:51 +00:00
Scott Taylor 55bb8b8c0b Comments: add a `'comment_excerpt_length'` filter to `get_comment_excerpt()`.
Create the first ever unit tests for `get_comment_excerpt()`.

Props dannydehaan, wonderboymusic.
Fixes #27526.


git-svn-id: https://develop.svn.wordpress.org/trunk@34520 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:04:16 +00:00
John Blackbourn c5a336d664 Use `WP_TESTS_DOMAIN` where it should be used in tests in place of hard-coded uses of `example.org`.
Also corrects a test value in the data provider for `Tests_Sanitize_Option::test_sanitize_option()` which was only consequentially passing.

Fixes #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@34519 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:01:10 +00:00
John Blackbourn b415937e4a Another missed file from [34172].
See #33877


git-svn-id: https://develop.svn.wordpress.org/trunk@34518 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 20:32:49 +00:00
Scott Taylor 0111ecef55 Canonical/Rewrite: sanity check posts that are paged with `<!--nextpage-->`. Page numbers past the max number of pages are returning the last page of content and causing infinite duplicate content.
Awesome rewrite bug: the `page` query var was being set to `'/4'` in `$wp`. When cast to `int`, it returns `0` (Bless you, PHP). `WP_Query` calls `trim( $page, '/' )` when setting its own query var. The few places that were checking `page`	before posts were queried now have sanity checks, so that these changes work without flushing rewrites.	

Adds/updates unit tests.

Props wonderboymusic, dd32.
See #11694.


git-svn-id: https://develop.svn.wordpress.org/trunk@34492 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 14:03:05 +00:00
Dominik Schilling (ocean90) 1efbe10b47 Customizer: Update tests for [34487].
Fixes #33634.

git-svn-id: https://develop.svn.wordpress.org/trunk@34488 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 11:31:30 +00:00
Scott Taylor e366584fae Unit Tests: after [34477], make `Tests_Link_GetPostCommentsFeedLink` more respectable.
See #33693.


git-svn-id: https://develop.svn.wordpress.org/trunk@34479 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 04:31:58 +00:00
Scott Taylor 158aecc3ec Feeds/Links: after [34336], use a different meat cleaver to fix Rewrite spillage across test cases.
Fixes #33693.


git-svn-id: https://develop.svn.wordpress.org/trunk@34477 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 04:19:56 +00:00
Scott Taylor bab2316129 Date/Time: Add unit tests for `the_date()`.
Props jubstuff.
Fixes #33750.


git-svn-id: https://develop.svn.wordpress.org/trunk@34474 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 03:33:21 +00:00
Gary Pendergast c47ef29b34 Tests: Remove a `var_dump()` added in [34373].
See #33070.



git-svn-id: https://develop.svn.wordpress.org/trunk@34468 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 03:07:20 +00:00
Scott Taylor d92723a33f Users: in `WP_User::__unset()`, don't reset the deprecated prop `id` to `ID`. Still throw the deprecated notice.
Update unit test.

Fixes #20043.


git-svn-id: https://develop.svn.wordpress.org/trunk@34466 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 00:48:23 +00:00
Scott Taylor c1c93f1e95 Widgets: when passing a string arg value to `dynamic_sidebar()`, don't reset `$index` when the arg's sanitized value matches the sanitized name of a sidebar.
Adds unit test.

Props tyxla, fjarrett.
Fixes #23423.


git-svn-id: https://develop.svn.wordpress.org/trunk@34465 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 00:29:54 +00:00
Boone Gorges daadd27ed4 Allow `comment_exists()` to match based on GMT date.
The `comment_date_gmt` field of the `wp_comments` table is indexed, which makes
`WHERE` matches against the field much faster than against the unindexed
`comment_date`. For bulk operations like data import, the speed difference can
be meaningful.

We continue to default to 'blog' for `$timezone`, to preserve compatibility
with existing uses.

Props apokalyptik.
Fixes #33871.

git-svn-id: https://develop.svn.wordpress.org/trunk@34460 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 18:15:39 +00:00
Boone Gorges cf3042389d Fix `comment_exists()` unit test introduced in [34456].
See #33871.

git-svn-id: https://develop.svn.wordpress.org/trunk@34457 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:46:36 +00:00
Boone Gorges 01c8e7a8e1 Add unit test for `comment_exists()`.
See #33871.

git-svn-id: https://develop.svn.wordpress.org/trunk@34456 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:34:37 +00:00
Boone Gorges e6b7c6b2d4 Bail early when invalid ID is passed to `get_comment_class()`.
This helps to avoid PHP notices later in the function.

Props walterebert, dipesh.kakadiya, DrewAPicture.
Fixes #33947.

git-svn-id: https://develop.svn.wordpress.org/trunk@34454 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:08:47 +00:00
Boone Gorges b23a1fc613 Add a few simple tests for `get_comment_class()`.
Props walterebert, dipesh.kakadiya.
See #33947.

git-svn-id: https://develop.svn.wordpress.org/trunk@34453 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-23 14:04:55 +00:00
John Blackbourn 9dd4680d2f Add tests for some missing capabilities, including `do_not_allow`.
See #32394.


git-svn-id: https://develop.svn.wordpress.org/trunk@34450 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 22:17:30 +00:00
John Blackbourn f1191d2e6e Correct a capability name in the roles and capabilities mapping. The `delete_others_pages` key was missing, and the `delete_others_posts` key was duplicated.
Introduced in [32812].

See #32394.


git-svn-id: https://develop.svn.wordpress.org/trunk@34449 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 22:15:18 +00:00
Aaron Jorbin dd25cc9a7c Add test image for test_exif_keywords test
[34374] added a test that relies on a new test image. This test image wasn't included in the commit.  This fixes the broken Tests_Image_Meta::test_exif_keywords test.

Props swissspidy, SteveHoneyNZ.
Fixes #33772.



git-svn-id: https://develop.svn.wordpress.org/trunk@34448 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 21:42:45 +00:00
johnbillion 50226ada19 Implement a test for capabilities for a custom post type that uses `capability_type => page`.
See #17253


git-svn-id: https://develop.svn.wordpress.org/trunk@34447 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 21:00:03 +00:00
Scott Taylor 0ad726ef4d Users: add `__unset` to `WP_User`.
Adds unit tests.

Props johnjamesjacoby, MikeHansenMe, wonderboymusic.
Fixes #20043.


git-svn-id: https://develop.svn.wordpress.org/trunk@34380 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:59:35 +00:00
wonderboymusic 70b90490fd Media: In `wp_read_image_metadata()`, include IPTC Keywords when available in `$meta`.
Adds unit test.

Props swissspidy, dbru, SteveHoneyNZ.
Fixes #33772.


git-svn-id: https://develop.svn.wordpress.org/trunk@34374 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:18:02 +00:00
Scott Taylor 1352d3473a Media: Add new functions, `get_the_post_thumbnail_url()` and `the_post_thumbnail_url()`.
Adds unit tests.

Props dipesh.kakadiya, swissspidy, atomicjack.
Fixes #33070.


git-svn-id: https://develop.svn.wordpress.org/trunk@34373 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:14:15 +00:00
Scott Taylor 3c0ecff16e Media: Add a new function, `wp_get_attachment_image_url()`, which is a shortcut for `wp_get_attachment_image_src()` - same function signature, but returns just the URL based on `$size`.
Adds unit test.

Props dipesh.kakadiya, swissspidy, sebastian.pisula.
Fixes #33878.


git-svn-id: https://develop.svn.wordpress.org/trunk@34372 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 04:12:44 +00:00
Scott Taylor f9d1856805 Help Tabs: when returning help tabs, return them in order of priority, but also return the items in each priority in the order that they were added.
Fixes #33941.


git-svn-id: https://develop.svn.wordpress.org/trunk@34370 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 03:36:27 +00:00
Scott Taylor e75c7651b2 HTTP: Add some new Cookie helper functions:
* `wp_remote_retrieve_cookies( $response )`
* `wp_remote_retrieve_cookie( $response, $name )`
* `wp_remote_retrieve_cookie_value( $response, $name )`

Adds unit tests.

Props johnbillion.
Fixes #33711.


git-svn-id: https://develop.svn.wordpress.org/trunk@34369 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-22 03:13:13 +00:00
Scott Taylor b55de4e5f8 Feeds/Links: fix feed links for unattached attachments.
Adds unit tests.

Props wonderboymusic, iworks.
Fixes #33693.


git-svn-id: https://develop.svn.wordpress.org/trunk@34336 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-19 20:09:05 +00:00
Scott Taylor d258115a28 After [34334], update unit tests.
See #33930.


git-svn-id: https://develop.svn.wordpress.org/trunk@34335 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-19 20:06:52 +00:00
Boone Gorges 2fd81992bc Split the comment query.
`WP_Comment_Query` now fetches comments in two stages: (1) a query to get the
IDs of comments matching the query vars, and (2) a query to populate the
objects corresponding to the matched IDs. The two queries are cached
separately, so that sites with persistent object caches will continue to have
complete cache coverage for normal comment queries.

Splitting the query allows our cache strategy to be more modest and precise, as
full comment data is only stored once per comment. It also makes it possible
to introduce logic for paginated threading, which is necessary to address
certain performance problems.

See #8071.
data is only stored once per comment, instead of along with

git-svn-id: https://develop.svn.wordpress.org/trunk@34310 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-18 19:27:39 +00:00
Scott Taylor d5e5ca8e93 Comments: in `wp_rel_nofollow_callback()`, account for the fact that a link might already have a `rel` attribute. Currently, if a link already has a `rel`, it will result it duplicate attributes on the element with conflicting values.
Adds unit tests.

Props junsuijin, wonderboymusic.
Fixes #9959.


git-svn-id: https://develop.svn.wordpress.org/trunk@34277 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-18 04:35:37 +00:00
Boone Gorges 504deb52fc Lazy-load comment meta on single post pages.
[34268] introduced cache priming for commentmeta, enabled by default. To
ensure performance on single post pages - where commentmeta is most likely
to cause performance issues - we disable up-front cache-priming. Instead, we
prime commentmeta caches for all comments in the loop the first time
`get_comment_meta()` is called on the page.

Props bradt, dd32, wonderboymusic, boonebgorges.
Fixes #16894.

git-svn-id: https://develop.svn.wordpress.org/trunk@34270 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 20:00:31 +00:00
Weston Ruter 5ea07785b3 Customize: Reduce peak memory usage by JSON-encoding settings and controls individually.
When there are hundreds of settings and controls (e.g. nav menu items and widget instances) the resulting object that is JSON-encoded can become very large, and `wp_json_encode()` can consume a lot of memory to serialize it. By breaking down the serialization into multiple calls the peak memory usage can be kept in line.

Moves logic out of `wp-admin/customize.php` into the `WP_Customize_Manager` class with new methods:

 * `is_ios()`
 * `get_document_title_template()`
 * `get_preview_url()`/`set_preview_url()`
 * `get_return_url()`/`set_return_url()`
 * `get_autofocus()`/`set_autofocus()`
 * `customize_pane_settings()`

Includes unit tests for these methods, for which the logic was formerly untestable in `customize.php`.

Fixes #33898.


git-svn-id: https://develop.svn.wordpress.org/trunk@34269 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 19:41:35 +00:00
Boone Gorges 12329f5ef8 Prime comment meta caches in `WP_Comment_Query`.
The new 'update_comment_meta_cache' parameter, which defaults to `true`, can
be used to disable this behavior.

`update_comment_cache()` has been updated to support an `$update_meta_cache`
parameter, which also updates to true; this matches the pattern we use for
priming post caches.

See #16894.

git-svn-id: https://develop.svn.wordpress.org/trunk@34268 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 19:29:46 +00:00
Scott Taylor 25710ecc67 In `wp_mime_type_icon()`, the length of the `$wilds` array varies depending on what is passed as `$mime`. Loop over `$wilds` instead of arbitrarily checking `$wilds[0]`.
Adds unit tests.

Fixes #33012.



git-svn-id: https://develop.svn.wordpress.org/trunk@34255 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-17 00:36:12 +00:00
Boone Gorges d26b868870 Don't notify post authors about spam comments.
[34106] moved post author notification to a hook, and in the process, missed
the 'spam' check. This changeset restores that check.

To make unit testing easier, the notification callbacks have been refactored
to return values: false when various conditions aren't met (eg, approved
comments should not trigger moderation emails), and the return value of the
`wp_notify_*()` function otherwise.

Props cfinke, kraftbj.
See #33587.

git-svn-id: https://develop.svn.wordpress.org/trunk@34250 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-16 21:59:16 +00:00
Boone Gorges 302e3d1116 Allow taxonomies to be non-public.
[13216] introduced the 'public' argument for `register_taxonomy()`. This param
was used to set defaults for 'show_ui' and a number of other params, but it
never did anything itself.

With this changeset, taxonomies registered with `public=false` will no longer
be queryable on the front end, ie via taxonomy archive queries.

Props wpsmith, ocean90, nacin, ericlewis, boonebgorges.
Fixes #21949.

git-svn-id: https://develop.svn.wordpress.org/trunk@34247 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-16 19:04:57 +00:00