Make WordPress Core

Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#58150 closed enhancement (fixed)

Use is_main_site() in WP_MS_Sites_List_Table::handle_row_actions()

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.3 Priority: low
Severity: normal Version:
Component: Networks and Sites Keywords: good-first-bug has-patch
Focuses: multisite, coding-standards Cc:

Description

There is a conditional in WP_MS_Sites_List_Table::handle_row_actions():

if ( get_network()->site_id !== (int) $blog['blog_id'] )

For better readability, I think it can be replaced with:

if ( ! is_main_site( $blog['blog_id'] ) )

That would also be more consistent with WP_MS_Sites_List_Table::column_cb(), which already uses is_main_site() for a similar check as of [25125].

Change History (7)

#1 @spacedmonkey
17 months ago

+1 I like this.

This ticket was mentioned in PR #4353 on WordPress/wordpress-develop by ecorica.


17 months ago
#2

  • Keywords has-patch added; needs-patch removed

#3 follow-up: @ecorica
17 months ago

Hello,

I'm at the contributor day in Paris and I pushed my first patch :)

#4 in reply to: ↑ 3 @SergeyBiryukov
17 months ago

Replying to ecorica:

I'm at the contributor day in Paris and I pushed my first patch :)

Looks great, thank you! :)

#5 @SergeyBiryukov
17 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 55666:

Networks and Sites: Simplify the check for main site on Network Admin → Sites screen.

This replaces a site ID comparison when displaying action links in WP_MS_Sites_List_Table::handle_row_actions() with a dedicated function call, is_main_site(), for clarity.

Follow-up to [13918], [25125], [26120], [32644], [38814].

Props ecorica, spacedmonkey, SergeyBiryukov.
Fixes #58150.

@SergeyBiryukov commented on PR #4353:


17 months ago
#6

Thanks for the PR! Merged in r55666.

#7 @SergeyBiryukov
17 months ago

In 55672:

Networks and Sites: Use is_main_site() in a few more places.

This updates some more instances of comparing site IDs on Sites and Users screens in network admin to use is_main_site() for clarity.

Follow-up to [12603], [13918], [22064], [38814], [41131], [55666].

See #58150.

Note: See TracTickets for help on using tickets.