The `get_comment` filter now explicitly documents returning `null` in addition to a `WP_Comment` object. This allows the filter to be used to exclude comments from an export. The `get_comment()` function already supported returning `null`.
Developed in https://github.com/WordPress/wordpress-develop/pull/8383
Props abcd95, WPExplorer, desrosj, mukesh27, westonruter, SirLouen, lbones, mdibrahimk48, audrasjb, jorbin, wildworks, hellofromTonya, saurabh.dhariwal, mabfahad.
Fixes#61244.
Built from https://develop.svn.wordpress.org/trunk@61369
git-svn-id: http://core.svn.wordpress.org/trunk@60681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Ensure that when a top level note is trashed (or deleted), all of its replies (children) are also trashed or deleted. If EMPTY_TRASH_DAYS is 0, notes are deleted immediately; otherwise they are marked as trash for later cleanup.
Props adamsilverstein, desrosj, wildworks, mamaduka, karthickmurugan, jeffpaul, shailu25.
Fixes#64240.
Built from https://develop.svn.wordpress.org/trunk@61248
git-svn-id: http://core.svn.wordpress.org/trunk@60560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Code maintenance follow up to r61179. Move `wp_new_comment_via_rest_notify_postauthor` callback from REST API Comments controller to comment.php. Add default to `wp_notes_notify` for multisite compatibility.
Props adamsilverstein, justlevine, mukesh27, mamaduka, peterwilsoncc, desros.
See #64204.
Built from https://develop.svn.wordpress.org/trunk@61199
git-svn-id: http://core.svn.wordpress.org/trunk@60535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix an issue where contributors’ notes edits were throttled. Notes are internal and from trusted users, they do not need throttling.
Skip calling wp_allow_comment for notes in WP_REST_Comments_Controller::create_item. As a result the pre_comment_approved hook is also not fired for notes.
Fixes https://github.com/WordPress/gutenberg/issues/72892 where the issue was originally reported.
Props adamsilverstein, desrosj, wildworks, mamaduka.
Fixes#64199.
Built from https://develop.svn.wordpress.org/trunk@61144
git-svn-id: http://core.svn.wordpress.org/trunk@60480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent notes from inadvertently showing up in the context of comments - including on the Dashboard recent comments widget and the “Mine” count on the Comments page. Notes are stored as a custom ‘note’ comment type and this change ensures the note type is only returned when explicitly requested, or when ‘all’ types are requested.
The query for note children is modified to return all child notes. This fixes an issue where children were no longer being returned for the ‘note’ type.
Also fixes https://github.com/WordPress/gutenberg/issues/72548.
Props adamsilverstein, timothyblynjacobs, shailu25, peterwilsoncc, westonruter, mamaduka, kadamwhite.
Fixes#64145.
Fixes#64152.
Built from https://develop.svn.wordpress.org/trunk@61105
git-svn-id: http://core.svn.wordpress.org/trunk@60441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds an `auth_callback` to the `_wp_note_status` comment meta so that only users with the `edit_comment` capability can update this meta field via the REST API.
This is necessary to ensure that users can properly resolve or reopen Notes.
Props wildworks, adamsilverstein, westonruter, mamaduka, desrosj.
Fixes#64153.
Built from https://develop.svn.wordpress.org/trunk@61089
git-svn-id: http://core.svn.wordpress.org/trunk@60425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Bring the PHP part of the new Notes feature into core for the 6.9 release. See related Gutenberg Issue: https://github.com/WordPress/gutenberg/issues/71826. These changes do not impact any user facing functionality, they simply prepare core for the JavaScript functionality that will come over in a separate sync.
Overview of changes:
- Ensure Notes are not included in comment counts
- Enable the note type (REST API)
- Adjust capabilities so edit_post cap implies ability to edit notes
- Enable empty and duplicate notes for resolve/re-open actions
- Add control over notes with post type supports check
- Register new note resolution status meta
Props: ristojovanovic, adamsilverstein, jeffpaul, wildworks, mamaduka, swissspidy, timothyblynjacobs, kadamwhite.
Fixes#64096.
Built from https://develop.svn.wordpress.org/trunk@60987
git-svn-id: http://core.svn.wordpress.org/trunk@60323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit corrects some parameter type issues concerning arrays. More specifically:
* `separate_comments()` now correctly indicates that it returns an array of `WP_Comment` objects, keyed by their string types.
* `_close_comments_for_old_posts()` now correctly indicates that it both takes and returns an array of `WP_Post` objects.
Follow-up to [8892], [8897], [8949], [32587], [42876].
Props justlevine, johnbillion.
See #63268.
Built from https://develop.svn.wordpress.org/trunk@60330
git-svn-id: http://core.svn.wordpress.org/trunk@59666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Document that unserialised data types are stored as strings in the database and returned as such by the meta data functions. For example, setting meta data to the integer value `1` will be returned as `"1"` when subsequently queried via `get_metadata()` and the related functions.
Props sukhendu2002, azaozz, jrf, rodrigosprimo.
Fixes ticket:61950.
Built from https://develop.svn.wordpress.org/trunk@59657
git-svn-id: http://core.svn.wordpress.org/trunk@59000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The previous approach of running `wp_allow_comment()` twice could have unintended consequences, e.g. the `check_comment_flood` action was also triggered twice, which might lead to false-positive identification of comment flood in case there is some custom callback hooked to it, which is not expecting identical data seeing twice.
This commit introduces a new function, `wp_check_comment_data()`, to specifically check for disallowed content before and after comment data is filtered.
Follow-up to [59267].
Props david.binda, SergeyBiryukov.
See #61827.
Built from https://develop.svn.wordpress.org/trunk@59319
git-svn-id: http://core.svn.wordpress.org/trunk@58705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that a Disallowed Comment Keys match will consistently send the comment to the Trash, by checking both the original unmodified comment data and the final filtered comment data.
If the first check has already resulted in a `trash` or `spam` status, the second check is skipped as redundant.
Follow-up to [2894], [3851], [48121], [48575].
Props cfinke, kbrownkd, thompsonsj, mi5t4n, devspace, chaion07, engahmeds3ed, SergeyBiryukov.
Fixes#61827.
Built from https://develop.svn.wordpress.org/trunk@59267
git-svn-id: http://core.svn.wordpress.org/trunk@58659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Removes the automatic addition of `rel="noopener noreferrer"` from links targeting a new tab or window, `target='_blank'`. Since this was introduced, supported browsers have changed their security policies and no longer allow the opened link to have JavaScript access to the previous tab.
Deprecates:
* `wp_targeted_link_rel()`
* `wp_targeted_link_rel_callback()`
* `wp_init_targeted_link_rel_filters()`: converted to a noop function
* `wp_remove_targeted_link_rel_filters()`: converted to a noop function
The deprecated functions are retained in `formatting.php` as in `SHORTINIT` mode the file is included while `deprecated.php` is not.
This also removes the `noopener` from links hard coded within the WordPress dashboard linking to documentation and other resources.
Props audrasjb, azaozz, dhruval04, dorzki, neo2k23, presskopp, sabernhardt, swissspidy, tobiasbg.
Fixes#53843.
Built from https://develop.svn.wordpress.org/trunk@59120
git-svn-id: http://core.svn.wordpress.org/trunk@58516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`set_time_limit` can cause unexpected behavior so it general should be avoided. There are instances though where they should be used so those instances should be properly documented.
Props Rcrayno, ryan, kurtpayne, jorbin.
Fixes#21521. See #19487.
Built from https://develop.svn.wordpress.org/trunk@59039
git-svn-id: http://core.svn.wordpress.org/trunk@58435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adds a note that the functions return either an empty array or an empty string for a valid but non-existing ID, depending on the `$single` parameter.
Follow-up to [48658], [50641].
Props rodrigosprimo, jrf.
See #61608.
Built from https://develop.svn.wordpress.org/trunk@58962
git-svn-id: http://core.svn.wordpress.org/trunk@58358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In cases where `WP_Comment_Query` or `get_comments` is employed with the 'count' parameter set to true, specify 'order by' as 'none'. Since these queries serve solely to determine the count of comments matching specific query parameters, the 'order by' clause becomes redundant and places unnecessary strain on the database server, resulting in slower query execution. Given that count queries are executed on every admin request to retrieve comment counts, this change enhances the performance of the wp-admin interface.
Props guss77, davidbaumwald, SergeyBiryukov, westonruter, peterwilsoncc, foliovision, hareesh-pillai, spacedmonkey.
Fixes#58368
Built from https://develop.svn.wordpress.org/trunk@56747
git-svn-id: http://core.svn.wordpress.org/trunk@56259 1a063a9b-81f0-0310-95a4-ce76da25c4cd