-
Notifications
You must be signed in to change notification settings - Fork 322
Fix: Create search template for all sites. #4258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
felipeelia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few questions for you on this one @burhandodhy
| * ## OPTIONS | ||
| * | ||
| * [--network-wide] | ||
| * : Delete the template for all sites in the network if plugin is network activated. Otherwise, delete the template for the current site only. | ||
| * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this also affect the method code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my mistake; I have added the code.
| $sites = Utils\get_sites( 0, true ); | ||
| foreach ( $sites as $site ) { | ||
| switch_to_blog( $site['blog_id'] ); | ||
| $this->index = Indexables::factory()->get( 'post' )->get_index_name(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn’t be there. I added that before making this change
Description of the Change
This PR ensures that the sync creates the search template across the network when the plugin is network-wide. It also adds support for the
network-wideflag forput-search-templatecommand.Additionally, we don’t need to set the
indexproperty during the constructor because if we runepio_save_site_search_template, the index property still holds the old value, which can cause incorrect endpoints.Closes #4227
How to test the Change
Changelog Entry
Credits
Props @burhandodhy @anjulahettige
Checklist: