Adding the `singular` class per default to the list of body classes is breaking the layout of Twenty Eleven and other themes. Twenty Eleven adds the `.singular` class only to single pages if the page doesn't use specific page templates.
Props flixos90, swissspidy.
Fixes#36510.
git-svn-id: https://develop.svn.wordpress.org/trunk@37249 602fd350-edb4-49c9-b593-d223f7449a82
* These should have been included in [37236] and [37238].
* Simplifies parameter names in `test_get_network_by_path()`
See #36566.
git-svn-id: https://develop.svn.wordpress.org/trunk@37239 602fd350-edb4-49c9-b593-d223f7449a82
This also helps to get things in order before the introduction of a more testable multisite bootstrap function in #34941.
A `@todo` has been temporarily removed, to be re-introduced as a working test.
See #36566.
git-svn-id: https://develop.svn.wordpress.org/trunk@37238 602fd350-edb4-49c9-b593-d223f7449a82
* Remove unnecessary `setUp` and `tearDown` methods.
* Create networks and sites in `wpSetupBeforeClass` to share throughout.
* Destroy networks and sites in `wpTearDownAfterClass` to unpollute.
See #36566, #34941.
git-svn-id: https://develop.svn.wordpress.org/trunk@37234 602fd350-edb4-49c9-b593-d223f7449a82
* Use `wp_update_network_counts()` to update the database with the most current data before testing.
* Use `wp_update_network_counts()` to update the database with the most current data after deleting the sites created during the test.
* Create only 1 extra site in each test rather than 4. This shaves several seconds off the test time.
* Stop testing for an extra count now that we update the network counts properly. Previously we looked at `$site_count_start + 9` rather than 8. Now this is `+ 1`, which aligns with the actual number of sites created.
* Test 3 explicit conditions - default, filter applied as `true`, and filter applied as `false`.
* Reset data before testing assertion to avoid a suspended state.
See #36566.
git-svn-id: https://develop.svn.wordpress.org/trunk@37233 602fd350-edb4-49c9-b593-d223f7449a82
When multisite is not configured, the `_site_transient()` and `_site_option()` functions fallback to `_option()` and store network "meta/options" in `wp_options`.
Previously, those calls to `_option()` did not explicitly set the `autoload` parameter and anything assigned as a transient or option at the network level would be set to `autoload` by default, even though autoload is not yet a concept at the network option level.
This changes that behavior and forces the `autoload` setting to `no`. If `autoload` is desired, the single site option functions should be used.
Props thomaswm.
Fixes#22846.
git-svn-id: https://develop.svn.wordpress.org/trunk@37223 602fd350-edb4-49c9-b593-d223f7449a82
The `_network_option()` functions are available to all and
internally use `_option()` functions as a fallback. We should
be testing for that scenario as well.
Fixes#36552.
git-svn-id: https://develop.svn.wordpress.org/trunk@37222 602fd350-edb4-49c9-b593-d223f7449a82
* `WP_Theme::network_enable_theme()` can be used to enable a theme or array of themes on a network.
* `WP_Theme::network_disable_theme()` can be used to disable a theme or array of themes on a network.
* Use these new methods in the network admin vs direct `update_site_option()` calls.
* Add tests.
Props igmoweb.
Fixes#30594.
git-svn-id: https://develop.svn.wordpress.org/trunk@37202 602fd350-edb4-49c9-b593-d223f7449a82
* Following pattern of `wp_get_mime_types()`, introduce `wp_get_ext_types()` function. New function returns a filtered list of file types with their extensions.
* Use this function in new tests for `wp_ext2type()`.
Props borgesbruno.
Fixes#35987.
git-svn-id: https://develop.svn.wordpress.org/trunk@37189 602fd350-edb4-49c9-b593-d223f7449a82
`LEFT JOIN` ensures that `NOT EXISTS` queries will not miss posts that have
no taxonomy data whatsoever.
Props swissspidy, crstauf.
Fixes#36343.
git-svn-id: https://develop.svn.wordpress.org/trunk@37184 602fd350-edb4-49c9-b593-d223f7449a82
This disables the concatenation of remaining enqueued scripts once `wp_add_inline_script()` is invoked, which allows us to reliably print these scripts and their before/after inline scripts in the desired order.
Props gitlost, azaozz, swisspidy, ocean90.
Fixes#36392.
git-svn-id: https://develop.svn.wordpress.org/trunk@37171 602fd350-edb4-49c9-b593-d223f7449a82
Theme support for `customize-selective-refresh-widgets` can be added _after_ the logic for registering the settings for incoming widgets that have been changed. This is due to themes adding the theme support in `after_setup_theme` which is also the action where `WP_Customize_Widgets::register_settings()` is called. If these both happen at priority 10, which one is called first depends on which one was added first. The other issue is that at the time that `WP_Customize_Widgets::register_settings()` is called at `after_setup_theme`, it is called before `widgets_init` and thus no widgets are yet registered. This means that any settings registered at this point will always have a `refresh` transport even if the theme supports `customize-selective-refresh-widgets`, since the `WP_Widget` instance is not visible yet to see if it supports selective refresh.
The fix: Defer `WP_Customize_Widgets::register_settings()` from `after_setup_theme` to `widgets_init` at priority 95 when the widget objects have all been registered. Also, ensure that the preview filter for `sidebars_widgets` is added before the sidebars are iterated for adding the controls.
Props westonruter.
Fixes#36389.
git-svn-id: https://develop.svn.wordpress.org/trunk@37166 602fd350-edb4-49c9-b593-d223f7449a82
Percent signs are reserved characters in URIs. As such, it was impossible for
plugins to route requests to trashed posts, as happens in bbPress. The new
`__trashed` suffix should be sufficiently unique.
Also adds a test that demonstrates that the `__trashed` suffix can be
appended to slugs that contain the suffix somewhere other than the end of
the string.
Props netweb, ericlewis.
Fixes#11863.
git-svn-id: https://develop.svn.wordpress.org/trunk@37165 602fd350-edb4-49c9-b593-d223f7449a82
We goofed, and parameters accessed through the REST API's methods
were slashed (inconsistently, even). This unslashes the data, so
you get the un-messed-with data that was sent.
Props joehoyle.
Fixes#36419.
git-svn-id: https://develop.svn.wordpress.org/trunk@37163 602fd350-edb4-49c9-b593-d223f7449a82
This reverts part of [34659] due to excessive canonical problems it's caused in 4.4.x.
Remove the unit tests which are no longer supported.
This also removes the `is_feed()` code to avoid confusion - only pages & embeds will be redirected.
Merges [36280] and [36281] to trunk.
Props dd32.
See #21602, #35344.
git-svn-id: https://develop.svn.wordpress.org/trunk@37075 602fd350-edb4-49c9-b593-d223f7449a82
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.
See #27355.
Fixes#35855.
git-svn-id: https://develop.svn.wordpress.org/trunk@37040 602fd350-edb4-49c9-b593-d223f7449a82
Confusion abound, the API index is the generic term `url` to display the `site_url`. New `home` key will display the `home_url` in the index as well.
Fixes#35647.
git-svn-id: https://develop.svn.wordpress.org/trunk@37031 602fd350-edb4-49c9-b593-d223f7449a82
Due to the "exclude" support added in WP 4.4, single dashes were being
converted to "NOT LIKE '%%'" clauses, causing all searches to fail.
Props RomSocial, swissspidy.
Fixes#36195.
git-svn-id: https://develop.svn.wordpress.org/trunk@36989 602fd350-edb4-49c9-b593-d223f7449a82
When passed an invalid `'taxonomy'`, `get_terms()` will return a `WP_Error`
object. This object should not be blindly cast to an array. Instead, an empty
array should be returned, to indicate that no matching terms have been found.
Props virgodesign, sebastian.pisula.
Fixes#36227.
git-svn-id: https://develop.svn.wordpress.org/trunk@36988 602fd350-edb4-49c9-b593-d223f7449a82
The test was introduced in [36646] was intended to demonstrate that the cap
check in `get_edit_term_link()` uses the custom capability from the correct
taxonomy when `$taxonomy` is not specified but must be inferred from the
provided term. However, the test was wrongly written in pretty much every way.
Antiprops boonebgorges.
Props swissspidy.
See #35922.
git-svn-id: https://develop.svn.wordpress.org/trunk@36986 602fd350-edb4-49c9-b593-d223f7449a82
Makes sure custom logo functions work for other sites within a network.
Fixes a bug in `get_custom_logo()` where the correct logo was returned, but
linked to the wrong site.
H/t ocean90.
See #33755, #36086.
git-svn-id: https://develop.svn.wordpress.org/trunk@36949 602fd350-edb4-49c9-b593-d223f7449a82
Dissolves `WP_CustomLogo` and adopts a structure similar to custom header and background (See `_delete_attachment_theme_mod()`).
The option to hide header text only gets added if it’s not already part of custom header, and only if selectors have been registered when theme support for custom logos was declared. Themes can add `postMessage` support for it as well.
Example:
{{{
add_theme_support( 'custom-logo', array(
'size' => ‘large’,
'header-text' => array( 'site-title', 'site-description' ),
) );
}}}
See #33755.
git-svn-id: https://develop.svn.wordpress.org/trunk@36915 602fd350-edb4-49c9-b593-d223f7449a82
* Request full refresh if there are nav menu instances that lack partials for a changed setting.
* Restore `WP_Customize_Nav_Menus::$preview_nav_menu_instance_args` and `WP_Customize_Nav_Menus::export_preview_data()` from 4.3, and keeping a tally of all `wp_nav_menu()` calls regardless of whether they can use selective refresh.
* Ensure that all instances of `wp_nav_menu()` are tallied, regardless of whether they are made during the initial preview call or during subsequent partial renderings. Export `nav_menu_instance_args` with each partial rendering response just as they are returned when rendering the preview as a whole.
* Fix issues with Custom Menu widget where nav menu items would fail to render when switching between menus when a menu lacked items to begin with.
* Make sure the fallback behavior is invoked when the partial is no longer associated with a menu.
* Do fallback behavior to refresh preview when all menu items are removed from a menu.
Follows [36586].
See #27355.
Fixes#35362.
git-svn-id: https://develop.svn.wordpress.org/trunk@36889 602fd350-edb4-49c9-b593-d223f7449a82