Repository navigation
Conversation
…nstallations. Updates default site options for fresh installations in populate_options(): - default_ping_status changes from 'open' to 'closed'. - default_pingback_flag changes from 1 to 0. Existing sites maintain their configured option values without disruption. Newly created posts on fresh installations default to closed pings, reducing spam, preventing SSRF/DDoS amplification via XML-RPC, and eliminating unnecessary outbound ping cron overhead while allowing administrators to opt back in via Settings > Discussion. Follow-up to [62417]. See #38207, #56362, #64837.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…or omitted X-Pingback headers. Follow-up to #38207, adjusting existing tests in Tests_Post_wpInsertPost to assert the new 'closed' ping_status default, and updating Tests_WP_SendHeaders to explicitly test both open and closed ping statuses.
…default. Follow-up to #38207, updating mockedApiResponse fixtures for PostsCollection, PostModel, and settings to reflect the new 'closed' ping_status and default_ping_status values.
This PR implements Phase 1 of retiring legacy pingback and trackback endpoints by disabling them by default on fresh installations.
Following the successful commit of changeset [62417] (Trac #64837), which disabled incoming and outgoing pings for non-production environments (
local,development,staging), this change addresses production fresh installs by updating default site options inpopulate_options():'default_ping_status'changes from'open'to'closed'.'default_pingback_flag'changes from1to0.Why this is necessary in 2026:
pingback.pinghas been used for over a decade by botnets as an amplification reflection vector against external targets.do_pingswhen posts contain external links.Backward Compatibility Guarantee (Phased Rollout)
populate_options(), WordPress queries existing options before insertion and skips any option already present in the database. Upgrading existing sites to WordPress 7.2 will not alter their currentdefault_ping_statusordefault_pingback_flagvalues.upgrade.php,wp_install_maybe_enable_pretty_permalinks()relies on theX-Pingbackheader from the sample "Hello world!" post. Becausewp_install_defaults()inserts the sample post directly into$wpdb->postswithout specifyingping_status, the column default ensures rewrite detection continues working seamlessly during installation.Changes Included:
src/wp-admin/includes/schema.php:'default_ping_status' => 'closed'(was'open').'default_pingback_flag' => 0(was1).tests/phpunit/tests/comment/pingsOpen.php:test_post_exist_status_open()to explicitly passarray( 'ping_status' => 'open' )when creating the post, ensuring test symmetry withtest_post_exist_status_closed().tests/phpunit/tests/comment/defaultPingStatus.php:'closed'and0).ping_status = 'closed'andpings_open() = false.'ping_status' => 'open'overrides.get_default_comment_status()parity forpingback,trackback, andcomment._publish_post_hook()suppressing_pingmepostmeta when the flag is 0._publish_post_hook()adding_pingmepostmeta when the flag is 1.populate_options()preservation of existing site options during upgrades.Testing & Verification:
vendor/bin/phpcs src/wp-admin/includes/schema.php tests/phpunit/tests/comment/defaultPingStatus.php tests/phpunit/tests/comment/pingsOpen.php: 3 / 3 (100%), 0 errors, 0 warnings.vendor/bin/phpunit tests/phpunit/tests/comment/defaultPingStatus.php: 9 tests, 16 assertions, 100% pass.vendor/bin/phpunit tests/phpunit/tests/comment/pingsOpen.php: 3 tests, 3 assertions, 100% pass.vendor/bin/phpunit tests/phpunit/tests/comment/disablePingsForEnvironment.php: 17 tests, 21 assertions, 100% pass.vendor/bin/phpunit tests/phpunit/tests/comment/pingback.php: 4 tests, 6 assertions, 100% pass.vendor/bin/phpunit tests/phpunit/tests/option/sanitizeOption.php: 65 tests, 80 assertions, 100% pass.Trac ticket: https://core.trac.wordpress.org/ticket/38207
See also: https://core.trac.wordpress.org/ticket/64837, https://core.trac.wordpress.org/ticket/56362
Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Identifying the schema default options, investigating backward-compatibility constraints in
populate_options(), reviewing core permalink dependencies inwp_install_maybe_enable_pretty_permalinks(), drafting the default option changes and dedicated unit tests indefaultPingStatus.php. All code changes, schema modifications, and test suite executions were reviewed and verified locally by robelsust.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.