跳转到主要内容

弃用说明

对于 Gutenberg 插件中包含的功能,弃用政策旨在尽可能支持向后兼容两个次要插件版本。WordPress 稳定版本中包含的功能和代码不在此弃用时间线内,而是遵循 WordPress 项目的版本控制政策。当前的弃用项如下所列,并按 它们将被完全移除的版本 分组。如果您的插件依赖这些行为,必须在指定版本前更新至推荐替代方案。

未发布版本

  • wp.blocks.isValidBlockContent 已被移除。请改用 wp.blocks.validateBlock。

11.0.0

  • wp.blocks.registerBlockTypeFromMetadata 方法已被移除。请改用 wp.blocks.registerBlockType 方法。

10.3.0

  • 不再支持将带有 as 属性的组件元组传递给 ActionItem.Slot 组件。请改为传递一个带有 as 属性的组件。示例:
    <ActionItem.Slot
    	name="my/slot"
    	label={ __( 'My slot' ) }
    - 	as={ [ MenuGroup, MenuItem ] }
    + 	as={ MenuGroup }
    />
    

9.7.0

  • InterfaceSkeleton 组件中的 leftSidebar 属性已被移除。请改用 secondarySidebar 属性。

8.6.0

  • 与区块上下文的区块 API 集成已更新。注册区块时,请在 JavaScript 文件中使用 usesContext 和 providesContext 对,在 PHP 文件中使用 uses_context 和 provides_context 对,以替代之前的 context 和 providesContext 对。

8.3.0

  • PHP 函数 gutenberg_get_post_from_context 已被移除。请改用区块上下文。
  • 旧的区块模式 API register_pattern/unregister_pattern 已被移除。请改用新函数。

5.5.0

  • 已移除 PHP 函数 gutenberg_init。
  • 已移除 PHP 函数 is_gutenberg_page。请改用 WP_Screen::is_block_editor。
  • 已移除 PHP 函数 the_gutenberg_project。
  • 已移除 PHP 函数 gutenberg_default_post_format_template。
  • 已移除 PHP 函数 gutenberg_get_available_image_sizes。
  • 已移除 PHP 函数 gutenberg_get_autosave_newer_than_post_save。
  • 已移除 PHP 函数 gutenberg_editor_scripts_and_styles。

5.4.0

  • 已移除 PHP 函数 gutenberg_load_plugin_textdomain。
  • 已移除 PHP 函数 gutenberg_get_jed_locale_data。
  • 已移除 PHP 函数 gutenberg_load_locale_data。

5.3.0

  • 已移除 PHP 函数 gutenberg_redirect_to_classic_editor_when_saving_posts。
  • 已移除 PHP 函数 gutenberg_revisions_link_to_editor。
  • 已移除 PHP 函数 gutenberg_remember_classic_editor_when_saving_posts。
  • 已移除 PHP 函数 gutenberg_can_edit_post_type。请改用 use_block_editor_for_post_type。
  • 已移除 PHP 函数 gutenberg_can_edit_post。请改用 use_block_editor_for_post。

5.2.0

  • PHP 函数 gutenberg_parse_blocks 已被移除。请改用 parse_blocks。
  • PHP 函数 get_dynamic_blocks_regex 已被移除。
  • PHP 函数 gutenberg_render_block 已被移除。请改用 render_block。
  • PHP 函数 strip_dynamic_blocks 已被移除。如需用于摘要准备,请考虑改用 excerpt_remove_blocks。
  • PHP 函数 strip_dynamic_blocks_add_filter 已被移除。
  • PHP 函数 strip_dynamic_blocks_remove_filter 已被移除。
  • PHP 函数 gutenberg_post_has_blocks 已被移除。请改用 has_blocks。
  • PHP 函数 gutenberg_content_has_blocks 已被移除。请改用 has_blocks。
  • PHP 函数 gutenberg_register_rest_routes 已被移除。
  • PHP 函数 gutenberg_add_taxonomy_visibility_field 已被移除。
  • PHP 函数 gutenberg_get_taxonomy_visibility_data 已被移除。
  • PHP 函数 gutenberg_add_permalink_template_to_posts 已被移除。
  • PHP 函数 gutenberg_add_block_format_to_post_content 已被移除。
  • PHP 函数 gutenberg_add_target_schema_to_links 已被移除。
  • PHP 函数 gutenberg_register_post_prepare_functions 已被移除。
  • PHP 函数 gutenberg_silence_rest_errors 已被移除。
  • PHP 函数 gutenberg_filter_post_type_labels 已被移除。
  • PHP 函数 gutenberg_preload_api_request 已被移除。请改用 rest_preload_api_request。
  • PHP 函数 gutenberg_remove_wpcom_markdown_support 已被移除。
  • PHP 函数 gutenberg_add_gutenberg_post_state 已被移除。
  • PHP 函数 gutenberg_bulk_post_updated_messages 已被移除。
  • PHP 函数 gutenberg_kses_allowedtags 已被移除。
  • PHP 函数 gutenberg_add_responsive_body_class 已被移除。
  • PHP 函数 gutenberg_add_edit_link_filters 已被移除。
  • PHP 函数 gutenberg_add_edit_link 已被移除。
  • PHP 函数 gutenberg_block_bulk_actions 已被移除。
  • PHP 函数 gutenberg_replace_default_add_new_button 已被移除。
  • PHP 函数 gutenberg_content_block_version 已被移除。请改用 block_version。
  • PHP 函数 gutenberg_get_block_categories 已被移除。请改用 get_block_categories。
  • PHP 函数 register_tinymce_scripts 已被移除。请改用 wp_register_tinymce_scripts。
  • PHP 函数 gutenberg_register_post_types 已被移除。
  • gutenberg 主题支持选项已被移除。请改用 align-wide。
  • PHP 函数 gutenberg_prepare_blocks_for_js 已被移除。请改用 get_block_editor_server_block_settings。
  • PHP 函数 gutenberg_load_list_reusable_blocks 已被移除。
  • PHP 函数 _gutenberg_utf8_split 已被移除。请改用 _mb_substr。
  • PHP 函数 gutenberg_disable_editor_settings_wpautop 已被移除。
  • PHP 函数 gutenberg_add_rest_nonce_to_heartbeat_response_headers 已被移除。
  • PHP 函数 gutenberg_check_if_classic_needs_warning_about_blocks 已被移除。
  • PHP 函数 gutenberg_warn_classic_about_blocks 已被移除。
  • PHP 函数 gutenberg_show_privacy_policy_help_text 已被移除。
  • PHP 函数 gutenberg_common_scripts_and_styles 已被移除。请改用 wp_common_block_scripts_and_styles。
  • PHP 函数 gutenberg_enqueue_registered_block_scripts_and_styles 已被移除。请改用 wp_enqueue_registered_block_scripts_and_styles。
  • PHP 函数 gutenberg_meta_box_save 已被移除。
  • PHP 函数 gutenberg_meta_box_save_redirect 已被移除。
  • PHP 函数 gutenberg_filter_meta_boxes 已被移除。
  • PHP 函数 gutenberg_intercept_meta_box_render 已被移除。
  • PHP 函数 gutenberg_override_meta_box_callback 已被移除。
  • PHP 函数 gutenberg_show_meta_box_warning 已被移除。
  • PHP 函数 the_gutenberg_metaboxes 已被移除。请改用 the_block_editor_meta_boxes。
  • PHP 函数 gutenberg_meta_box_post_form_hidden_fields 已被移除。请改用 the_block_editor_meta_box_post_form_hidden_fields。
  • PHP 函数 gutenberg_toggle_custom_fields 已被移除。
  • PHP 函数 gutenberg_collect_meta_box_data 已被移除。请改用 register_and_do_post_meta_boxes。
  • window._wpLoadGutenbergEditor 已被移除。请改用 window._wpLoadBlockEditor。注意:这是一个私有 API,不供公共使用。未来可能会被移除。
  • PHP 函数 gutenberg_get_script_polyfill 已被移除。请改用 wp_get_script_polyfill。
  • PHP 函数 gutenberg_add_admin_body_class 已被移除。如果需要在样式表中限定样式到块编辑器屏幕,请使用 .block-editor-page 类选择器。

4.5.0

  • Dropdown.refresh() 已被弃用,因为其包含的 Popover 现在会自动刷新。
  • wp.editor.PostPublishPanelToggle 已被弃用,建议使用 wp.editor.PostPublishButton。

4.4.0

  • wp.date.getSettings 已被移除。请改用 wp.date.__experimentalGetSettings。
  • wp.compose.remountOnPropChange 已被移除。
  • 以下编辑器存储操作已被移除:createNotice、removeNotice、createSuccessNotice、createInfoNotice、createErrorNotice、createWarningNotice。请使用 @wordpress/notices 模块中同名的等效操作。
  • wp.nux.DotTip 的 id 属性已被移除。请改用 tipId 属性。
  • wp.blocks.isValidBlock 已被移除。请改用 wp.blocks.isValidBlockContent,但请注意参数顺序已更改。
  • wp.data 的 registry.registerReducer 已被弃用。请改用 registry.registerStore。
  • wp.data 的 registry.registerSelectors 已被弃用。请改用 registry.registerStore。
  • wp.data 的 registry.registerActions 已被弃用。请改用 registry.registerStore。
  • wp.data 的 registry.registerResolvers 已被弃用。请改用 registry.registerStore。
  • moment 已从日期模块的公共 API 中移除。

4.3.0

  • isEditorSidebarPanelOpened 选择器 (core/edit-post) 已被移除。请改用 isEditorPanelEnabled。
  • toggleGeneralSidebarEditorPanel 操作 (core/edit-post) 已被移除。请改用 toggleEditorPanelOpened。
  • wp.components.PanelColor 组件已被移除。请改用 wp.editor.PanelColorSettings。
  • wp.editor.PanelColor 组件已被移除。请改用 wp.editor.PanelColorSettings。

4.2.0

  • 已移除将解析器写作异步生成器的功能。请改用 controls 插件。
  • 已移除 wp.components.AccessibleSVG 组件。请改用 wp.components.SVG。
  • wp.editor.UnsavedChangesWarning 组件不再接受 forceIsDirty 属性。
  • 已移除 setActiveMetaBoxLocations 操作 (core/edit-post)。
  • 已移除 initializeMetaBoxState 操作 (core/edit-post)。
  • wp.editPost.initializeEditor 不再返回对象。请使用 setActiveMetaBoxLocations 操作 (core/edit-post) 来替代原对象的 initializeMetaBoxes 函数。
  • 已移除 setMetaBoxSavedData 操作 (core/edit-post)。
  • 已移除 getMetaBoxes 选择器 (core/edit-post)。请改用 getActiveMetaBoxLocations 选择器 (core/edit-post)。
  • 已移除 getMetaBox 选择器 (core/edit-post)。请改用 isMetaBoxLocationActive 选择器 (core/edit-post)。
  • 已移除属性类型强制转换。请省略 source 以通过序列化的注释定界符来保留类型。
  • wp.editor.mediaUpload 的 onFileChange 回调所接收对象中的 mediaDetails。请改用 media_details 属性。
  • 已移除 wp.components.CodeEditor。请直接使用 wp.codeEditor。
  • 已移除 wp.blocks.setUnknownTypeHandlerName。请改用 setFreeformContentHandlerName 和 setUnregisteredTypeHandlerName。
  • 已移除 wp.blocks.getUnknownTypeHandlerName。请改用 getFreeformContentHandlerName 和 getUnregisteredTypeHandlerName。
  • 可重用块数据 API 已标记为实验性,因其未来可能发生变化。

4.1.0

  • wp.data.dispatch( 'core/editor' ).checkTemplateValidity 已被移除。区块重置时会自动验证有效性。

4.0.0

  • wp.editor.RichTextProvider 已被移除。请改用 wp.data.select( 'core/editor' ) 方法。
  • 作为 DOM 节点拖拽处理器的 wp.components.Draggable 已被移除。请将 wp.components.Draggable 作为包装组件用于你的 DOM 节点拖拽处理器。
  • wp.i18n.getI18n 已被移除。请改用 __、_x、_n 或 _nx。
  • wp.i18n.dcnpgettext 已被移除。请改用 __、_x、_n 或 _nx。

3.9.0

  • RichText 的 getSettings 属性已被移除。如需继续使用,可使用 unstableGetSettings 属性。强烈不建议使用不稳定 API,它们可能会在未经通知的情况下被移除。
  • RichText 的 onSetup 属性已被移除。如需继续使用,可使用 unstableOnSetup 属性。强烈不建议使用不稳定 API,它们可能会在未经通知的情况下被移除。
  • wp.editor.getColorName 已被移除。请改用 wp.editor.getColorObjectByColorValue。
  • wp.editor.getColorClass 已重命名。请改用 wp.editor.getColorClassName。
  • wp.editor.withColors 传递的颜色对象中的 value 属性已被移除。请改用 color 属性。
  • 副标题区块已被移除。请改用段落区块。
  • wp.blocks.getDefaultBlockForPostFormat 已被移除。

3.8.0

  • wp.components.withContext has been removed. Please use wp.element.createContext instead. See: https://react.dev/reference/react/createContext.
  • wp.coreBlocks.registerCoreBlocks has been removed. Please use wp.blockLibrary.registerCoreBlocks instead.
  • wp.editor.DocumentTitle component has been removed.
  • getDocumentTitle selector (core/editor) has been removed.

3.7.0

  • wp.components.withAPIData 已被移除。请直接使用核心数据模块或 wp.apiFetch。
  • wp.data.dispatch("core").receiveTerms 已被弃用。请改用 wp.data.dispatch("core").receiveEntityRecords。
  • getCategories 解析器已被弃用。请改用 getEntityRecords 解析器。
  • wp.data.select("core").getTerms 已被弃用。请改用 wp.data.select("core").getEntityRecords。
  • wp.data.select("core").getCategories 已被弃用。请改用 wp.data.select("core").getEntityRecords。
  • wp.data.select("core").isRequestingCategories 已被弃用。请改用 wp.data.select("core/data").isResolving。
  • wp.data.select("core").isRequestingTerms 已被弃用。请改用 wp.data.select("core").isResolving。
  • wp.data.restrictPersistence、wp.data.setPersistenceStorage 和 wp.data.setupPersistence 已被移除。请改用数据持久化插件。

3.6.0

  • wp.editor.editorMediaUpload 已被移除。请改用 wp.editor.mediaUpload。
  • wp.utils.getMimeTypesArray 已被移除。
  • wp.utils.mediaUpload 已被移除。请改用 wp.editor.mediaUpload。
  • wp.utils.preloadImage 已被移除。
  • supports.wideAlign 已从区块 API 中移除。请改用 supports.alignWide。
  • wp.blocks.isSharedBlock 已被移除。请改用 wp.blocks.isReusableBlock。
  • fetchSharedBlocks 操作 (core/editor) 已被移除。请改用 fetchReusableBlocks。
  • receiveSharedBlocks 操作 (core/editor) 已被移除。请改用 receiveReusableBlocks。
  • saveSharedBlock 操作 (core/editor) 已被移除。请改用 saveReusableBlock。
  • deleteSharedBlock 操作 (core/editor) 已被移除。请改用 deleteReusableBlock。
  • updateSharedBlockTitle 操作 (core/editor) 已被移除。请改用 updateReusableBlockTitle。
  • convertBlockToSaved 操作 (core/editor) 已被移除。请改用 convertBlockToReusable。
  • getSharedBlock 选择器 (core/editor) 已被移除。请改用 getReusableBlock。
  • isSavingSharedBlock 选择器 (core/editor) 已被移除。请改用 isSavingReusableBlock。
  • isFetchingSharedBlock 选择器 (core/editor) 已被移除。请改用 isFetchingReusableBlock。
  • getSharedBlocks 选择器 (core/editor) 已被移除。请改用 getReusableBlocks。

3.5.0

  • wp.components.ifCondition 已被移除。请改用 wp.compose.ifCondition。
  • wp.components.withGlobalEvents 已被移除。请改用 wp.compose.withGlobalEvents。
  • wp.components.withInstanceId 已被移除。请改用 wp.compose.withInstanceId。
  • wp.components.withSafeTimeout 已被移除。请改用 wp.compose.withSafeTimeout。
  • wp.components.withState 已被移除。请改用 wp.compose.withState。
  • wp.element.pure 已被移除。请改用 wp.compose.pure。
  • wp.element.compose 已被移除。请改用 wp.compose.compose。
  • wp.element.createHigherOrderComponent 已被移除。请改用 wp.compose.createHigherOrderComponent。
  • wp.utils.buildTermsTree 已被移除。
  • wp.utils.decodeEntities 已被移除。请改用 wp.htmlEntities.decodeEntities。
  • 所有对区块 uid 的引用已替换为针对 clientId 的等效属性和选择器。
  • wp.editor.MediaPlaceholder 组件的 onSelectUrl 属性已重命名为 onSelectURL。
  • wp.editor.UrlInput 组件已重命名为 wp.editor.URLInput。
  • 文本列区块已被移除。请改用列区块。
  • InnerBlocks 的分组布局已被移除。请改用中间嵌套的内部区块。请参考列/栏目区块的实现。
  • RichText 显式的 element 格式已被移除。请改用兼容的 children 格式。

3.4.0

  • Popover 组件中的 focusOnMount 属性已从仅接受 Boolean 值更改为枚举式属性,现接受 "firstElement"、"container" 或 false。请将所有 <Popover focusOnMount /> 用法转换为 <Popover focusOnMount="firstElement" />。
  • 移除了 wp.utils.keycodes 工具函数。请改用 wp.keycodes。
  • 移除了 edit 函数中的块 id 属性。请改用块的 clientId 属性。
  • 移除了 property 源。请改用等效的 text、html 或 attribute 源,或注释属性。

3.3.0

  • 已从 Block API 中移除 useOnce: true。请改用 supports.multiple: false。
  • 使用 componentWillMount 生命周期方法序列化组件。请改用构造函数。
  • 已移除 blocks.Autocomplete.completers 过滤器。请改用 editor.Autocomplete.completers。
  • 已移除 blocks.BlockEdit 过滤器。请改用 editor.BlockEdit。
  • 已移除 blocks.BlockListBlock 过滤器。请改用 editor.BlockListBlock。
  • 已移除 blocks.MediaUpload 过滤器。请改用 editor.MediaUpload。

3.2.0

  • wp.data.withRehydratation 已重命名为 wp.data.withRehydration。
  • wp.editor.ImagePlaceholder 组件已移除。请改用 wp.editor.MediaPlaceholder。
  • wp.utils.deprecated 函数已移除。请改用 wp.deprecated。
  • wp.utils.blob 已移除。请改用 wp.blob。
  • getInserterItems:移除了 allowedBlockTypes 参数,并新增了 parentUID 参数。
  • getFrecentInserterItems 选择器已移除。请改用 getInserterItems。
  • getSupportedBlocks 选择器已移除。请改用 canInsertBlockType。

3.1.0

  • wp.blocks.* 中的所有组件已被移除。请改用 wp.editor.*。
  • wp.blocks.withEditorSettings 已被移除。请使用数据模块访问编辑器设置 wp.data.select( "core/editor" ).getEditorSettings()。
  • wp.utils.* 中的所有 DOM 工具函数已被移除。请改用 wp.dom.*。
  • Block API 中的 isPrivate: true 已被移除。请改用 supports.inserter: false。
  • wp.utils.isExtraSmall 函数已被移除。请改用 wp.viewport 模块。
  • getEditedPostExcerpt 选择器(core/editor)已被移除。请改用 getEditedPostAttribute( 'excerpt' )。

3.0.0

  • 移除了 wp.blocks.registerCoreBlocks 函数。请改用 wp.coreBlocks.registerCoreBlocks。
  • RichText 的原始 TinyMCE 事件处理器已被弃用。请改用文档化的属性、祖先事件处理器,或通过 onSetup 访问内部编辑器实例的事件中心。

2.8.0

  • wp.components.Autocomplete 中的原始自动补全接口已更新。请改用最新的自动补全接口。更多信息请参阅自动补全。
  • getInserterItems:allowedBlockTypes 参数现为必填项。
  • getFrecentInserterItems:allowedBlockTypes 参数现为必填项。

2.7.0

  • 移除了 wp.element.getWrapperDisplayName 函数。请改用 wp.element.createHigherOrderComponent。

2.6.0

  • 移除了 wp.blocks.getBlockDefaultClassname 函数。请改用 wp.blocks.getBlockDefaultClassName。
  • 移除了 wp.blocks.Editable 组件。请改用 wp.blocks.RichText 组件。

2.5.0

  • 不再支持从块 save 函数返回原始 HTML。请改用 wp.element.RawHTML 组件。
  • 移除了 wp.data.query 高阶组件。请改用 wp.data.withSelect。

2.4.0

  • 移除了 wp.blocks.BlockDescription 组件。请改用 description 区块属性。
  • 移除了 wp.blocks.InspectorControls.* 组件。请改用 wp.components.* 组件。
  • 移除了 wp.blocks.source.* 匹配器。请改用声明式属性。更多信息请参阅区块属性。
  • 移除了 wp.data.select( 'selector', ...args )。请改用 wp.data.select( reducerKey' ).*。
  • 移除了 wp.blocks.MediaUploadButton 组件。请改用 wp.blocks.MediaUpload 组件。