Automattic / babble

Multilingual WordPress done right.
https://wordpress.org/plugins/babble/
245 stars 50 forks source link

When a static front page is configured, the Appearance Menus Screen and search functionality are negatively impacted. #330

Open richaber opened 8 years ago

richaber commented 8 years ago

With a default twenty* theme active, the Babble plugin enabled, languages configured, and translated content available, go to the Appearance Menus Screen and note that all content is available in the menu item meta boxes as expected.

Go to the front end of the site and perform a search. Note that the search functionality works as expected.

Now go to the Settings Reading Screen in Admin, and set a static front page.

After setting the static front page, return to the Appearance Menus Screen and note that not all content is available in the menu item meta boxes.

In fact, it appears that only the static front page is available to choose from in any post type menu item metabox. This implies that the front page is "taking over" the menu items available in the metaboxes on the Appearance Menus Screen.

Additionally, perform a new search from the front end of the site, and note that search no longer returns results, no matter the language, no matter the content searched for. This implies that the search query_var is dropped at some point, but only when a static front page has been configured.

Note the check for the page_on_front option at line 1069 of the Babble_Post_Public::translate_query_vars method on the develop branch.

if ( 'page' == get_option('show_on_front') && $page_on_front = get_option('page_on_front') ) {

It appears that this check is interfering with both the menu items metaboxes on the Appearance Menus Screen, and the search functionality, when a static front page has been set.

Changing that check to

if ( ! isset( $query_vars['s'] ) && 'page' == get_option( 'show_on_front' ) && $page_on_front = get_option( 'page_on_front' ) ) {

appears to resolve both the Appearance Menus Screen issues and search functionality issues.

In my testing, this did not appear to have a negative impact on any other expected functionality.