Skip to content

pre_site_option filter in get_network_option#10053

Closed
nimesh-xecurify wants to merge 9 commits intoWordPress:trunkfrom
nimesh-xecurify:56870-pre-site-option-filter
Closed

pre_site_option filter in get_network_option#10053
nimesh-xecurify wants to merge 9 commits intoWordPress:trunkfrom
nimesh-xecurify:56870-pre-site-option-filter

Conversation

@nimesh-xecurify
Copy link

@nimesh-xecurify nimesh-xecurify commented Sep 26, 2025

Adding unit test and making changes in @audrasjb 's PR (#10030) as per suggestions from @aaronjorbin

Trac ticket: https://core.trac.wordpress.org/ticket/56870

@github-actions
Copy link

github-actions bot commented Sep 26, 2025

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props nimeshatxecurify, westonruter, shailu25.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

// The global pre filter should short-circuit and return $return_val regardless of actual storage.
$this->assertSame( $return_val, get_network_option( $network_id, $option, $default_val ) );
} finally {
remove_filter( 'pre_site_option', $callback, 10 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try/catch shouldn't be needed, and no need to remove_filter(). They get reset after each test.

* @param int $network_id ID of the network.
* @param mixed $default_value The fallback value to return if the option does not exist.
* Default false.
*@since 6.9.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@since tag should add before @param tag

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 60959
GitHub commit: ebe36e8

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Oct 17, 2025
@nimesh-xecurify nimesh-xecurify deleted the 56870-pre-site-option-filter branch February 19, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants