diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md
index f92e2d94751dc..a7570bf590a39 100644
--- a/docs/reference-guides/core-blocks.md
+++ b/docs/reference-guides/core-blocks.md
@@ -270,7 +270,7 @@ Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenb
## Footnotes
- ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/footnotes))
+Display footnotes added to the page. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/footnotes))
- **Name:** core/footnotes
- **Category:** text
@@ -384,7 +384,7 @@ Show login & logout links. ([Source](https://github.com/WordPress/gutenberg/tree
- **Name:** core/loginout
- **Category:** theme
-- **Supports:** className, typography (fontSize, lineHeight)
+- **Supports:** className, spacing (margin, padding), typography (fontSize, lineHeight)
- **Attributes:** displayLoginAsForm, redirectToCurrent
## Media & Text
diff --git a/lib/block-supports/background.php b/lib/block-supports/background.php
index bf5945312348b..b4779b1a150e4 100644
--- a/lib/block-supports/background.php
+++ b/lib/block-supports/background.php
@@ -41,7 +41,7 @@ function gutenberg_register_background_support( $block_type ) {
*/
function gutenberg_render_background_support( $block_content, $block ) {
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
- $block_attributes = $block['attrs'];
+ $block_attributes = ( isset( $block['attrs'] ) && is_array( $block['attrs'] ) ) ? $block['attrs'] : array();
$has_background_image_support = block_has_support( $block_type, array( 'background', 'backgroundImage' ), false );
if (
diff --git a/lib/compat/wordpress-6.3/script-loader.php b/lib/compat/wordpress-6.3/script-loader.php
index 9cbd3771ee328..c8de16efd0687 100644
--- a/lib/compat/wordpress-6.3/script-loader.php
+++ b/lib/compat/wordpress-6.3/script-loader.php
@@ -12,101 +12,3 @@
*/
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
remove_action( 'in_admin_header', 'wp_global_styles_render_svg_filters' );
-
-/**
- * Collect the block editor assets that need to be loaded into the editor's iframe.
- *
- * @since 6.0.0
- * @access private
- *
- * @return array {
- * The block editor assets.
- *
- * @type string|false $styles String containing the HTML for styles.
- * @type string|false $scripts String containing the HTML for scripts.
- * }
- */
-function _gutenberg_get_iframed_editor_assets() {
- global $wp_styles, $wp_scripts, $pagenow;
-
- // Keep track of the styles and scripts instance to restore later.
- $current_wp_styles = $wp_styles;
- $current_wp_scripts = $wp_scripts;
-
- // Create new instances to collect the assets.
- $wp_styles = new WP_Styles();
- $wp_scripts = new WP_Scripts();
-
- // Register all currently registered styles and scripts. The actions that
- // follow enqueue assets, but don't necessarily register them.
- $wp_styles->registered = $current_wp_styles->registered;
- $wp_scripts->registered = $current_wp_scripts->registered;
-
- // We generally do not need reset styles for the iframed editor.
- // However, if it's a classic theme, margins will be added to every block,
- // which is reset specifically for list items, so classic themes rely on
- // these reset styles.
- $wp_styles->done =
- wp_theme_has_theme_json() ? array( 'wp-reset-editor-styles' ) : array();
-
- wp_enqueue_script( 'wp-polyfill' );
- // Enqueue the `editorStyle` handles for all core block, and dependencies.
- wp_enqueue_style( 'wp-edit-blocks' );
-
- if ( 'site-editor.php' === $pagenow ) {
- wp_enqueue_style( 'wp-edit-site' );
- }
-
- if ( current_theme_supports( 'wp-block-styles' ) ) {
- wp_enqueue_style( 'wp-block-library-theme' );
- }
-
- // We don't want to load EDITOR scripts in the iframe, only enqueue
- // front-end assets for the content.
- add_filter( 'should_load_block_editor_scripts_and_styles', '__return_false' );
- do_action( 'enqueue_block_assets' );
- remove_filter( 'should_load_block_editor_scripts_and_styles', '__return_false' );
-
- $block_registry = WP_Block_Type_Registry::get_instance();
-
- // Additionally, do enqueue `editorStyle` assets for all blocks, which
- // contains editor-only styling for blocks (editor content).
- foreach ( $block_registry->get_all_registered() as $block_type ) {
- if ( isset( $block_type->editor_style_handles ) && is_array( $block_type->editor_style_handles ) ) {
- foreach ( $block_type->editor_style_handles as $style_handle ) {
- wp_enqueue_style( $style_handle );
- }
- }
- }
-
- // Remove the deprecated `print_emoji_styles` handler.
- // It avoids breaking style generation with a deprecation message.
- remove_action( 'wp_print_styles', 'print_emoji_styles' );
- ob_start();
- wp_print_styles();
- $styles = ob_get_clean();
- add_action( 'wp_print_styles', 'print_emoji_styles' );
-
- ob_start();
- wp_print_head_scripts();
- wp_print_footer_scripts();
- $scripts = ob_get_clean();
-
- // Restore the original instances.
- $wp_styles = $current_wp_styles;
- $wp_scripts = $current_wp_scripts;
-
- return array(
- 'styles' => $styles,
- 'scripts' => $scripts,
- );
-}
-
-add_filter(
- 'block_editor_settings_all',
- static function ( $settings ) {
- // We must override what core is passing now.
- $settings['__unstableResolvedAssets'] = _gutenberg_get_iframed_editor_assets();
- return $settings;
- }
-);
diff --git a/lib/experimental/fonts/font-library/class-wp-font-collection.php b/lib/experimental/fonts/font-library/class-wp-font-collection.php
index 5b3702ae865d1..3dd9b5fed764f 100644
--- a/lib/experimental/fonts/font-library/class-wp-font-collection.php
+++ b/lib/experimental/fonts/font-library/class-wp-font-collection.php
@@ -79,7 +79,7 @@ public function get_config() {
*/
public function get_data() {
// If the src is a URL, fetch the data from the URL.
- if ( false !== strpos( $this->config['src'], 'http' ) && false !== strpos( $this->config['src'], '://' ) ) {
+ if ( str_contains( $this->config['src'], 'http' ) && str_contains( $this->config['src'], '://' ) ) {
if ( ! wp_http_validate_url( $this->config['src'] ) ) {
return new WP_Error( 'font_collection_read_error', __( 'Invalid URL for Font Collection data.', 'gutenberg' ) );
}
diff --git a/packages/block-library/src/footnotes/block.json b/packages/block-library/src/footnotes/block.json
index 28b094f24f916..4a2db992863db 100644
--- a/packages/block-library/src/footnotes/block.json
+++ b/packages/block-library/src/footnotes/block.json
@@ -4,7 +4,7 @@
"name": "core/footnotes",
"title": "Footnotes",
"category": "text",
- "description": "",
+ "description": "Display footnotes added to the page.",
"keywords": [ "references" ],
"textdomain": "default",
"usesContext": [ "postId", "postType" ],
diff --git a/packages/block-library/src/footnotes/index.php b/packages/block-library/src/footnotes/index.php
index 5924db3a190c2..184bff2da9578 100644
--- a/packages/block-library/src/footnotes/index.php
+++ b/packages/block-library/src/footnotes/index.php
@@ -242,7 +242,8 @@ function _wp_rest_api_autosave_meta( $autosave ) {
return;
}
- update_post_meta( $id, 'footnotes', wp_slash( $body['meta']['footnotes'] ) );
+ // Can't use update_post_meta() because it doesn't allow revisions.
+ update_metadata( 'post', $id, 'footnotes', wp_slash( $body['meta']['footnotes'] ) );
}
// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L391C1-L391C1.
add_action( 'wp_creating_autosave', '_wp_rest_api_autosave_meta' );
diff --git a/packages/block-library/src/loginout/block.json b/packages/block-library/src/loginout/block.json
index 3593961c09cfd..59fceec596e37 100644
--- a/packages/block-library/src/loginout/block.json
+++ b/packages/block-library/src/loginout/block.json
@@ -19,6 +19,14 @@
},
"supports": {
"className": true,
+ "spacing": {
+ "margin": true,
+ "padding": true,
+ "__experimentalDefaultControls": {
+ "margin": false,
+ "padding": false
+ }
+ },
"typography": {
"fontSize": true,
"lineHeight": true,
diff --git a/packages/block-library/src/search/style.scss b/packages/block-library/src/search/style.scss
index 5e8755857f93a..b8a446721241b 100644
--- a/packages/block-library/src/search/style.scss
+++ b/packages/block-library/src/search/style.scss
@@ -55,11 +55,12 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
margin-left: 0;
// Prevent unintended text wrapping.
flex-shrink: 0;
- // Ensure minimum input field width in small viewports.
+ max-width: 100%;
+ }
+
+ // Ensure minimum input field width in small viewports.
+ .wp-block-search__button[aria-expanded="true"] {
max-width: calc(100% - 100px);
- &.has-icon {
- max-width: 100%;
- }
}
}
diff --git a/packages/block-library/src/table-of-contents/edit.js b/packages/block-library/src/table-of-contents/edit.js
index 915375606b10c..30101fe9419b9 100644
--- a/packages/block-library/src/table-of-contents/edit.js
+++ b/packages/block-library/src/table-of-contents/edit.js
@@ -19,6 +19,8 @@ import {
import { useDispatch, useSelect } from '@wordpress/data';
import { renderToString } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
+import { useInstanceId } from '@wordpress/compose';
+import { store as noticeStore } from '@wordpress/notices';
/**
* Internal dependencies
@@ -50,6 +52,24 @@ export default function TableOfContentsEdit( {
useObserveHeadings( clientId );
const blockProps = useBlockProps();
+ const instanceId = useInstanceId(
+ TableOfContentsEdit,
+ 'table-of-contents'
+ );
+
+ // If a user clicks to a link prevent redirection and show a warning.
+ const { createWarningNotice, removeNotice } = useDispatch( noticeStore );
+ let noticeId;
+ const showRedirectionPreventedNotice = ( event ) => {
+ event.preventDefault();
+ // Remove previous warning if any, to show one at a time per block.
+ removeNotice( noticeId );
+ noticeId = `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`;
+ createWarningNotice( __( 'Links are disabled in the editor.' ), {
+ id: noticeId,
+ type: 'snackbar',
+ } );
+ };
const canInsertList = useSelect(
( select ) => {
@@ -137,8 +157,12 @@ export default function TableOfContentsEdit( {
return (
<>
{ toolbarControls }
diff --git a/packages/block-library/src/table-of-contents/list.tsx b/packages/block-library/src/table-of-contents/list.tsx
index e327f8dfe2e86..c5a5192b9e4f1 100644
--- a/packages/block-library/src/table-of-contents/list.tsx
+++ b/packages/block-library/src/table-of-contents/list.tsx
@@ -1,3 +1,8 @@
+/**
+ * External dependencies
+ */
+import type { MouseEvent } from 'react';
+
/**
* WordPress dependencies
*/
@@ -12,8 +17,12 @@ const ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';
export default function TableOfContentsList( {
nestedHeadingList,
+ disableLinkActivation,
+ onClick,
}: {
nestedHeadingList: NestedHeadingData[];
+ disableLinkActivation?: boolean;
+ onClick?: ( event: MouseEvent< HTMLAnchorElement > ) => void;
} ): WPElement {
return (
<>
@@ -21,7 +30,17 @@ export default function TableOfContentsList( {
const { content, link } = node.heading;
const entry = link ? (
-
+
{ content }
) : (
@@ -35,6 +54,15 @@ export default function TableOfContentsList( {
) : null }
diff --git a/packages/components/README.md b/packages/components/README.md
index f324cb48c66d7..f3e4399fe3d51 100644
--- a/packages/components/README.md
+++ b/packages/components/README.md
@@ -29,17 +29,12 @@ Many components include CSS to add styles, which you will need to load in order
In non-WordPress projects, link to the `build-style/style.css` file directly, it is located at `node_modules/@wordpress/components/build-style/style.css`.
-### Popovers and Tooltips
-
-_If you're using [`Popover`](/packages/components/src/popover/README.md) or [`Tooltip`](/packages/components/src/tooltip/README.md) components outside of the editor, make sure they are rendered within a `SlotFillProvider` and with a `Popover.Slot` somewhere up the element tree._
+### Popovers
By default, the `Popover` component will render within an extra element appended to the body of the document.
If you want to precisely contol where the popovers render, you will need to use the `Popover.Slot` component.
-A `Popover` is also used as the underlying mechanism to display `Tooltip` components.
-So the same considerations should be applied to them.
-
The following example illustrates how you can wrap a component using a
`Popover` and have those popovers render to a single location in the DOM.
@@ -58,7 +53,7 @@ const Example = () => {
-
+ ;
};
```
diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js
index f60a8af7d39a0..45d2dc6c47ad7 100644
--- a/packages/core-commands/src/site-editor-navigation-commands.js
+++ b/packages/core-commands/src/site-editor-navigation-commands.js
@@ -24,7 +24,7 @@ import { useIsTemplatesAccessible, useIsBlockBasedTheme } from './hooks';
import { unlock } from './lock-unlock';
import { orderEntityRecordsBySearch } from './utils/order-entity-records-by-search';
-const { useHistory } = unlock( routerPrivateApis );
+const { useHistory, useLocation } = unlock( routerPrivateApis );
const icons = {
post,
@@ -136,6 +136,14 @@ const getNavigationCommandLoaderPerPostType = ( postType ) =>
const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
function useNavigationCommandLoader( { search } ) {
const history = useHistory();
+ const location = useLocation();
+
+ const isPatternsPage =
+ location?.params?.path === '/patterns' ||
+ location?.params?.postType === 'wp_block';
+ const didAccessPatternsPage =
+ !! location?.params?.didAccessPatternsPage;
+
const isBlockBasedTheme = useIsBlockBasedTheme();
const { records, isLoading } = useSelect( ( select ) => {
const { getEntityRecords } = select( coreStore );
@@ -184,6 +192,11 @@ const getNavigationCommandLoaderPerTemplate = ( templateType ) =>
const args = {
postType: templateType,
postId: record.id,
+ didAccessPatternsPage:
+ ! isBlockBasedTheme &&
+ ( isPatternsPage || didAccessPatternsPage )
+ ? 1
+ : undefined,
...extraArgs,
};
const targetUrl = addQueryArgs(
diff --git a/packages/edit-site/src/components/add-new-pattern/index.js b/packages/edit-site/src/components/add-new-pattern/index.js
index 32e677a6a39c3..014ac6165aaef 100644
--- a/packages/edit-site/src/components/add-new-pattern/index.js
+++ b/packages/edit-site/src/components/add-new-pattern/index.js
@@ -11,6 +11,7 @@ import {
privateApis as editPatternsPrivateApis,
store as patternsStore,
} from '@wordpress/patterns';
+import { store as coreStore } from '@wordpress/core-data';
import { store as noticesStore } from '@wordpress/notices';
/**
@@ -19,7 +20,6 @@ import { store as noticesStore } from '@wordpress/notices';
import CreateTemplatePartModal from '../create-template-part-modal';
import SidebarButton from '../sidebar-button';
import { unlock } from '../../lock-unlock';
-import { store as editSiteStore } from '../../store';
import {
PATTERN_TYPES,
PATTERN_DEFAULT_CATEGORY,
@@ -36,9 +36,8 @@ export default function AddNewPattern() {
const [ showPatternModal, setShowPatternModal ] = useState( false );
const [ showTemplatePartModal, setShowTemplatePartModal ] =
useState( false );
- const isTemplatePartsMode = useSelect( ( select ) => {
- const settings = select( editSiteStore ).getSettings();
- return !! settings.supportsTemplatePartsMode;
+ const isBlockBasedTheme = useSelect( ( select ) => {
+ return select( coreStore ).getCurrentTheme()?.is_block_theme;
}, [] );
const { createPatternFromFile } = unlock( useDispatch( patternsStore ) );
const { createSuccessNotice, createErrorNotice } =
@@ -52,7 +51,7 @@ export default function AddNewPattern() {
history.push( {
postId: pattern.id,
postType: PATTERN_TYPES.user,
- categoryType: PATTERN_TYPES.user,
+ categoryType: PATTERN_TYPES.theme,
categoryId,
canvas: 'edit',
} );
@@ -82,9 +81,7 @@ export default function AddNewPattern() {
},
];
- // Remove condition when command palette issues are resolved.
- // See: https://github.com/WordPress/gutenberg/issues/52154.
- if ( ! isTemplatePartsMode ) {
+ if ( isBlockBasedTheme ) {
controls.push( {
icon: symbolFilled,
onClick: () => setShowTemplatePartModal( true ),
diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js b/packages/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js
index 4da9cf0713b19..de0c1cfa16ec6 100644
--- a/packages/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js
+++ b/packages/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js
@@ -42,7 +42,7 @@ function CollectionFontDetails( {
handleToggleVariant={ handleToggleVariant }
selected={ isFontFontFaceInOutline(
font.slug,
- face,
+ font.fontFace ? face : null, // If the font has no fontFace, we want to check if the font is in the outline
fontToInstallOutline
) }
/>
diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/context.js b/packages/edit-site/src/components/global-styles/font-library-modal/context.js
index eb5d56e8b4c9b..3abc0576863ee 100644
--- a/packages/edit-site/src/components/global-styles/font-library-modal/context.js
+++ b/packages/edit-site/src/components/global-styles/font-library-modal/context.js
@@ -281,14 +281,16 @@ function FontLibraryProvider( { children } ) {
} );
// Add custom fonts to the browser.
fontsToAdd.forEach( ( font ) => {
- font.fontFace.forEach( ( face ) => {
- // Load font faces just in the iframe because they already are in the document.
- loadFontFaceInBrowser(
- face,
- getDisplaySrcFromFontFace( face.src ),
- 'iframe'
- );
- } );
+ if ( font.fontFace ) {
+ font.fontFace.forEach( ( face ) => {
+ // Load font faces just in the iframe because they already are in the document.
+ loadFontFaceInBrowser(
+ face,
+ getDisplaySrcFromFontFace( face.src ),
+ 'iframe'
+ );
+ } );
+ }
} );
};
diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/utils/fonts-outline.js b/packages/edit-site/src/components/global-styles/font-library-modal/utils/fonts-outline.js
index 0414681a432ad..bef9353e94350 100644
--- a/packages/edit-site/src/components/global-styles/font-library-modal/utils/fonts-outline.js
+++ b/packages/edit-site/src/components/global-styles/font-library-modal/utils/fonts-outline.js
@@ -15,7 +15,8 @@ export function getFontsOutline( fonts ) {
}
export function isFontFontFaceInOutline( slug, face, outline ) {
- return (
- outline[ slug ]?.[ `${ face.fontStyle }-${ face.fontWeight }` ] || false
- );
+ if ( ! face ) {
+ return !! outline[ slug ];
+ }
+ return !! outline[ slug ]?.[ `${ face.fontStyle }-${ face.fontWeight }` ];
}
diff --git a/packages/edit-site/src/components/page-template-parts/index.js b/packages/edit-site/src/components/page-template-parts/index.js
index f53ea6c10c554..2a8c41e333ce2 100644
--- a/packages/edit-site/src/components/page-template-parts/index.js
+++ b/packages/edit-site/src/components/page-template-parts/index.js
@@ -9,6 +9,7 @@ import {
import { __ } from '@wordpress/i18n';
import { useEntityRecords } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';
+import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
* Internal dependencies
@@ -20,8 +21,15 @@ import AddedBy from '../list/added-by';
import TemplateActions from '../template-actions';
import AddNewTemplatePart from './add-new-template-part';
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
+import { unlock } from '../../lock-unlock';
+
+const { useLocation } = unlock( routerPrivateApis );
export default function PageTemplateParts() {
+ const {
+ params: { didAccessPatternsPage },
+ } = useLocation();
+
const { records: templateParts } = useEntityRecords(
'postType',
TEMPLATE_PART_POST_TYPE,
@@ -40,8 +48,13 @@ export default function PageTemplateParts() {
params={ {
postId: templatePart.id,
postType: templatePart.type,
+ didAccessPatternsPage: !! didAccessPatternsPage
+ ? 1
+ : undefined,
+ } }
+ state={ {
+ backPath: '/wp_template_part/all',
} }
- state={ { backPath: '/wp_template_part/all' } }
>
{ decodeEntities(
templatePart.title?.rendered ||
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js
index 14c137eed3791..70325f09bd21d 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js
@@ -10,6 +10,8 @@ import { useViewportMatch } from '@wordpress/compose';
import { getTemplatePartIcon } from '@wordpress/editor';
import { __ } from '@wordpress/i18n';
import { getQueryArgs } from '@wordpress/url';
+import { store as coreStore } from '@wordpress/core-data';
+import { useSelect } from '@wordpress/data';
import { file } from '@wordpress/icons';
/**
@@ -27,6 +29,7 @@ import {
import { useLink } from '../routes/link';
import usePatternCategories from './use-pattern-categories';
import useTemplatePartAreas from './use-template-part-areas';
+import { store as editSiteStore } from '../../store';
function TemplatePartGroup( { areas, currentArea, currentType } ) {
return (
@@ -93,8 +96,23 @@ export default function SidebarNavigationScreenPatterns() {
const { templatePartAreas, hasTemplateParts, isLoading } =
useTemplatePartAreas();
const { patternCategories, hasPatterns } = usePatternCategories();
+ const isBlockBasedTheme = useSelect(
+ ( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,
+ []
+ );
+ const isTemplatePartsMode = useSelect( ( select ) => {
+ const settings = select( editSiteStore ).getSettings();
+ return !! settings.supportsTemplatePartsMode;
+ }, [] );
+
+ const templatePartsLink = useLink( {
+ path: '/wp_template_part/all',
+ // If a classic theme that supports template parts accessed
+ // the Patterns page directly, preserve that state in the URL.
+ didAccessPatternsPage:
+ ! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,
+ } );
- const templatePartsLink = useLink( { path: '/wp_template_part/all' } );
const footer = ! isMobileViewport ? (
{ __( 'Manage all of my patterns' ) }
-
- { __( 'Manage all template parts' ) }
-
+ { ( isBlockBasedTheme || isTemplatePartsMode ) && (
+
+ { __( 'Manage all template parts' ) }
+
+ ) }
) : undefined;
return (
{
- const settings = select( editSiteStore ).getSettings();
-
- return !! settings.supportsTemplatePartsMode;
+ return !! select( editSiteStore ).getSettings()
+ .supportsTemplatePartsMode;
}, [] );
return (
self::$global_styles_id,
@@ -160,7 +160,7 @@ public static function wpSetupBeforeClass( $factory ) {
),
);
- wp_update_post( $new_styles_post, true, false );
+ wp_update_post( $new_styles_post, true, true );
$new_styles_post = array(
'ID' => self::$global_styles_id,
@@ -190,7 +190,7 @@ public static function wpSetupBeforeClass( $factory ) {
),
);
- wp_update_post( $new_styles_post, true, false );
+ wp_update_post( $new_styles_post, true, true );
wp_set_current_user( 0 );
}
diff --git a/phpunit/tests/fonts/font-library/wpFontLibrary/setUploadDir.php b/phpunit/tests/fonts/font-library/wpFontLibrary/setUploadDir.php
index be15ecce89881..daa4c84aad900 100644
--- a/phpunit/tests/fonts/font-library/wpFontLibrary/setUploadDir.php
+++ b/phpunit/tests/fonts/font-library/wpFontLibrary/setUploadDir.php
@@ -15,14 +15,16 @@ class Tests_Fonts_WpFontLibrary_SetUploadDir extends WP_UnitTestCase {
public function test_should_set_fonts_upload_dir() {
$defaults = array(
'subdir' => '/abc',
- 'basedir' => '/var/www/html/wp-content',
- 'baseurl' => 'http://example.com/wp-content',
+ 'basedir' => '/any/path',
+ 'baseurl' => 'http://example.com/an/arbitrary/url',
+ 'path' => '/any/path/abc',
+ 'url' => 'http://example.com/an/arbitrary/url/abc',
);
$expected = array(
'subdir' => '/fonts',
- 'basedir' => '/var/www/html/wp-content',
+ 'basedir' => WP_CONTENT_DIR,
'baseurl' => content_url(),
- 'path' => '/var/www/html/wp-content/fonts',
+ 'path' => path_join( WP_CONTENT_DIR, 'fonts' ),
'url' => content_url() . '/fonts',
);
$this->assertSame( $expected, WP_Font_Library::set_upload_dir( $defaults ) );
diff --git a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/base.php b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/base.php
index 5caa40b289293..a6b02f38a5e81 100644
--- a/phpunit/tests/fonts/font-library/wpRestFontLibraryController/base.php
+++ b/phpunit/tests/fonts/font-library/wpRestFontLibraryController/base.php
@@ -39,7 +39,7 @@ public function tear_down() {
$reflection = new ReflectionClass( 'WP_Font_Library' );
$property = $reflection->getProperty( 'collections' );
$property->setAccessible( true );
- $property->setValue( array() );
+ $property->setValue( null, array() );
// Clean up the /fonts directory.
foreach ( $this->files_in_dir( static::$fonts_dir ) as $file ) {