Make WordPress Core

Opened 4 years ago

Last modified 6 weeks ago

#56886 new enhancement

Admin facing add site screen missing search engine visibility field

Reported by: imath Owned by:
Priority: normal Milestone: Future Release
Component: Networks and Sites Version:
Severity: normal Keywords: good-first-bug has-patch needs-testing
Cc: Focuses: multisite

Description

When a user wants to add a new site on Multisite configs, they can use the site privacy radio buttons, see screenshot below:

/wp-signup.php

https://cldup.com/0bMdIrVLRE.png

But when a super admin wants to add a new site, they have no way to choose this setting during site creation, they need to create a "public" site, then go into the Reading settings to eventually switch to hidden to search engines. In this particular case, a super admin has less power than a regular user :)

/wp-admin/network/site-new.php

https://cldup.com/Tg7E2F-bwR.png

The attached patch is adding these missing site privacy radio buttons to let a super admin decide whether a new site should be "public" or not.

patched /wp-admin/network/site-new.php

https://cldup.com/hiFEfNw3_V.png

Attachments (6)

56886.patch​ (1.8 KB ) - added by imath 4 years ago.
56886.2.patch​ (3.6 KB ) - added by helpdesk 5 months ago.
add site screen missing search engine visibility field
56886.3(1).patch​ (3.0 KB ) - added by sachinrajcp123 4 months ago.
ticket-56886-playground-unchecked.png​ (77.6 KB ) - added by arkaprabhachowdhury 2 months ago.
ticket-56886-playground-checked.png​ (77.7 KB ) - added by arkaprabhachowdhury 2 months ago.
56886-pr13309-add-site.png​ (76.6 KB ) - added by binsaifullah 6 weeks ago.
Add Site screen with PR 13309 applied (multisite, Playground)

Download all attachments as: .zip

Change History (34)

#1 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review → 6.2

#2 @abidhasan112
4 years ago

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/56886/56886.patch

Environment

  • OS: macOS 13.0
  • Web Server: Nginx
  • PHP: 8.1.9
  • WordPress: 6.2-alpha-55080
  • Browser: Chrome 108.0.5359.124
  • Theme: Twenty Twenty-Three
  • Active Plugins: No plugins activated

Actual Results

  • ✅ Issue resolved with patch.

Additional Notes

I have tested the patch and it seems to be the radio buttons appeared as expected. But I'm not sure about the functionality about the search engine. How can I test it in the search engine, please let me know.

Supplemental Artifacts

Before:
https://i.ibb.co/GWhpTQt/Markup-2023-01-17-at-15-57-51.png

After:
https://i.ibb.co/Xj9hstn/Markup-2023-01-17-at-16-16-03.png

#3 follow-up: @peterwilsoncc
4 years ago

If there is an E2E test suite that runs in multiste mode, it would be great if some tests could be added to ensure Allow search engines to index this site appears on the relevant page.

@ironprogrammer do you know if such a test suite exits?

This ticket was mentioned in ​Slack in #core-test by robinwpdeveloper. ​View the logs.


4 years ago

#6 @costdev
4 years ago

  • Keywords changes-requested added

The patch needs some updates.

  • The markup has changed for this field. See ​the current markup on the install page. This includes hooks.
  • The patch seems to be processing all of the $blog['meta'], which goes outside the scope of this ticket.
  • intval() should be replaced with (int).
  • wp_unslash() shouldn't be necessary here. It's being converted to an integer.
Last edited 4 years ago by costdev (previous) (diff)

#7 in reply to: ↑ 3 @ironprogrammer
4 years ago

Replying to peterwilsoncc:

If there is an E2E test suite that runs in multiste mode, it would be great if some tests could be added to ensure Allow search engines to index this site appears on the relevant page.

@ironprogrammer do you know if such a test suite exits?

I don't believe there are any multisite E2E tests. A great idea though 😅

If this option is added to the multisite admin, could it be worded/designed to have better parity with the single site admin?

https://cldup.com/ICmdRpctXK.png

I realize the current patch is based on what is currently displayed to users on wp-signup.php, but "Discourage search engines from indexing this site" more accurately reflects this option. It would also simplify the interface if this was a checkbox, rather than radios.

#8 @desrosj
4 years ago

  • Summary Although users can set a new site's visibility for search engines, the super admin can't :) → Admin facing add site screen missing search engine visibility field
  • Version trunk

I think I'd argue that this is an enhancement and not a bug, but I don't feel strongly enough to change the type without others agreeing.

Even though the admin screen shows less to super admins than the front end form, I'm wondering if this was intentional. If I had to guess, I would say that these forms are both intentionally short. But if that conversation did occur, it was likely a really long time ago.

Regardless, it does make sense to me for both locations to match what is available.

This ticket was mentioned in ​Slack in #core by costdev. ​View the logs.


4 years ago

#10 @costdev
4 years ago

  • Milestone 6.2 → 6.3
  • Type defect (bug) → enhancement

This ticket was discussed during the bug scrub. There was agreement by myself, @hellofromTonya and @johnbillion that this is an enhancement, and should be moved to 6.3.

#11 @johnbillion
4 years ago

As discussed in the bug scrub, this is more of an enhancement than a bug so I'm bumping it to 6.3. I agree that adding this field to the screen mostly makes sense, but I wouldn't want to add too many fields as that's what the settings screens are for.

#12 @oglekler
3 years ago

@audrasjb could you please address the changes requested in #comment:6?

#13 @audrasjb
3 years ago

  • Milestone 6.3 → 6.4

Given this enhancement still needs some work and as WP 6.3 beta 1 is going to be released in a couple days, let's move this to milestone 6.4.

#14 @oglekler
3 years ago

@imath and @audrasjb could you please address the changes requested in #comment:6?
There are not so many :)

#15 @oglekler
3 years ago

  • Keywords good-first-bug added

Because requested changes are not difficult, I am marking this as good first bug.

But we have 9 days until Beta 1 and if someone is interested to see this change in the 6.4, it needs to be done asap or the ticket will be rescheduled to 6.5.

This ticket was mentioned in ​Slack in #core by oglekler. ​View the logs.


3 years ago

#17 @oglekler
3 years ago

  • Milestone 6.4 → 6.5

Because the patch needs a bit of work, and we are in two days before the Beta 1, I am moving this ticket into 6.5. It can go in trunk as soon as the patch will be ready and trunk open again after 6.4 will be branched out.

#18 @sagargurnani
3 years ago

Hello all, I am actively working on updating the latest patch.

Last edited 3 years ago by sagargurnani (previous) (diff)

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


3 years ago

#20 @audrasjb
3 years ago

  • Milestone 6.5 → Future Release

As per today's bug scrub:
Moving to future release as no update has been proposed since the last punt from 6.4 to 6.5.

@helpdesk
5 months ago

add site screen missing search engine visibility field

#21 @audrasjb
5 months ago

  • Keywords needs-testing added; changes-requested removed
  • Milestone Future Release → 7.1

Thanks @helpdesk for the patch!
Moving to 7.1.

#22 @jamesbregenzer
5 months ago

Tested the latest patch (56886.2.patch) against current trunk in a local WordPress multisite environment.

Environment:

  • WordPress trunk (7.1-alpha)
  • Multisite enabled
  • No additional plugins active

Test steps:

  1. Applied the patch.
  2. Visited Network Admin → Sites → Add Site.
  3. Verified the new “Search engine visibility” checkbox appears on the Add Site screen.
  4. Created a site with the checkbox checked.
  5. Confirmed Settings → Reading on the new site shows “Discourage search engines from indexing this site” enabled.
  6. Created a second site with the checkbox unchecked.
  7. Confirmed Settings → Reading on the new site shows the setting disabled.

Results:

  • Checkbox displays correctly on the Add Site screen.
  • Site creation succeeds when the checkbox is checked or unchecked.
  • The selected visibility preference is persisted correctly to the newly created site’s Reading Settings.
  • Did not observe any regressions during testing.

Patch tests successfully for me.

#23 @mirmpro
5 months ago

Verified the latest patch for ticket #56886 directly within a local multisite network setup.

Setup Details:

Core: WordPress 7.1-alpha (trunk)
Multisite: Active
Extensions: No active plugins
Verification Process:

  1. Applied the provided diff to the repository.
  2. Loaded the Network Admin dashboard and went straight to the Add Site creation form.
  3. Checked that the new Search Engine Visibility checkbox was visible on screen.
  4. Generated a new sub-site with the box checked, then logged into that site to confirm the "Discourage search engines" setting was active.
  5. Generated a second sub-site with the box unchecked, and verified the privacy setting remained disabled on that instance.

The privacy checkbox rendered exactly where intended, sub-site creation completed smoothly in both states, and the indexing preference carried over accurately into the new site options. Everything looks stable with no regression found.

#24 @wildworks
4 months ago

With less than a week until 7.1 Beta1, I'd like to check the status of this ticket.

Since multiple patches and PRs are attached, let's first decide which ones to review. It would be best to move forward with ​https://github.com/WordPress/wordpress-develop/pull/3882/, as it's easier to review and CI checks can be run.

#25 @wildworks
4 months ago

  • Milestone 7.1 → Future Release

Punting this as the release of 7.1 Beta1 is imminent.

This ticket was mentioned in ​PR #13309 on ​WordPress/wordpress-develop by ​@raulsalvat.


2 months ago
#26

This PR provides a refreshed implementation for #56886 and references the existing PR #3882, whose current implementation predates the later requested changes.

The implementation:

  • scopes handling specifically to blog_public;
  • preserves the default public = 1 behavior when no visibility option is submitted;
  • uses the Network Admin Add Site form with a "Search engine visibility" checkbox;
  • uses blog[options][blog_public] rather than generic blog[meta] processing;
  • avoids intval() and unnecessary wp_unslash() in the new handling;
  • preserves the existing network_site_new_form extension point;
  • uses the current "Discourage search engines from indexing this site" wording.

Validation performed against current trunk for the exact submitted source change:

  • git diff --check: PASS
  • PHP syntax: PASS
  • PHPCS for src/wp-admin/network/site-new.php: PASS
  • Multisite regression tests: 220 tests, 596 assertions, PASS
  • tests/phpunit/tests/option/sanitizeOption.php: 65 tests, 80 assertions, PASS
  • Total selected tests: 285
  • Total selected assertions: 676
  • Network Admin Add Site form rendering: PASS
  • Omitted visibility input creates the site with blog_public = 1: PASS
  • Explicit blog[options][blog_public] = 0 creates the site with blog_public = 0: PASS
  • Temporary behavior-test sites were removed successfully.

Existing PR context: #3882.

This PR does not assert that any attached Trac patch supersedes another attachment.

​@raulsalvat commented on ​PR #13309:


2 months ago
#27

This contribution has been refreshed onto current WordPress trunk.

Current head: 9a5d9c5eab72c5ff4239adf5a28210253984a764

Fresh validation on this exact head:

  • 134 successful checks
  • 0 failing
  • 0 cancelled
  • 0 pending
  • GitHub reports the PR as MERGEABLE

The implementation is ready for upstream review. The PR body contains the current behavior and validation details.

Related earlier implementation/context: #3882.

@binsaifullah
6 weeks ago

Add Site screen with PR 13309 applied (multisite, Playground)

#28 @binsaifullah
6 weeks ago

Test Report

Patch tested: ​PR 13309

Environment

  • WordPress: 7.2-alpha (trunk + PR 13309, via the Playground PR previewer)
  • Multisite: yes (subdirectory, enableMultisite blueprint step)
  • PHP: 8.3
  • Browser: Chrome
  • OS: macOS
  • Plugins: none

Screenshot

Add Site screen with PR 13309 applied (multisite, Playground)

Steps / Results

  1. Network Admin → Sites → Add Site: the "Search engine visibility" row with the "Discourage search engines from indexing this site" checkbox appears below the admin email notice. ✅
  2. Created hidden-site with the box checked:
    • Settings → Reading on the new site: "Discourage search engines" is checked. ✅
    • Network → Edit Site → Info: the "Public" attribute is unchecked. ✅
    • Front end outputs <meta name='robots' content='noindex, nofollow' />. ✅
  3. Created public-site with the box unchecked: Reading setting unchecked, "Public" attribute checked, no noindex robots meta. ✅
  4. Posted blog[options][blog_public]=-1 (unexpected value): the site is created as public, so the default is kept. ✅
  5. Invalid admin email: the site is rejected via wp_die() as before, and no site is created. ✅
  6. Clicking the label toggles the checkbox (label for="blog_public"). ✅

Code review against comment:6

  • Only blog_public is handled, not all of $blog['meta']. ✅
  • No intval() or wp_unslash(). It compares against the string '0'. ✅
  • Markup "including hooks", compared with wp-admin/install.php:
    • The description <p> has no id, and the checkbox has no aria-describedby. install.php uses aria-describedby="options-site-visibility-description". Suggest adding both for screen readers.
    • There's no has_action( 'blog_privacy_selector' ) branch or do_action( 'blog_privacy_selector' ). install.php and options-reading.php switch to radios plus that hook when plugins add extra privacy levels. If parity is wanted, the processing would need to accept those values too (e.g. (int) instead of only '0'). If that's out of scope here, that's fine to note.
  • Minor: checked( isset( $_POST[...] ) ... ) never takes effect, because a failed submission ends in wp_die() and the form is never shown again after a POST. It's harmless.

Notes

In comment:24, @wildworks suggested moving forward with PR 3882. That PR still has all the issues from comment:6 (it processes every blog[meta] key, uses intval( wp_unslash() ), and uses radio buttons). PR 13309 addresses those, so it may be the better PR to review now.

PR 13309 works as expected in my testing. The open question is whether to add the aria-describedby and blog_privacy_selector parity.

Note: See TracTickets for help on using tickets.