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

未发布

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

11.0.0

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

10.3.0

  • 不再支持向 ActionItem.Slot 组件传递带有 as prop 的组件元组。请改为传递带有 as prop 的单个组件。示例:
    “`diff
    <ActionItem.Slot
    name=”my/slot”
    label={ __( ‘My slot’ ) }
    • as={ [ MenuGroup, MenuItem ] }
    • as={ MenuGroup }
      />
      “`

9.7.0

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

8.6.0

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

8.3.0

  • PHP 函数 gutenberg_get_post_from_context 已被移除。请改用 Block Context。
  • 旧的 Block Pattern APIs 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 已被移除。
  • 以下编辑器存储操作(actions)已被移除:createNotice, removeNotice, createSuccessNotice, createInfoNotice, createErrorNotice, createWarningNotice。请使用来自 @wordpress/notices 模块的同名等效操作。
  • wp.nux.DotTip 的 id prop 已被移除。请使用 tipId prop 代替。
  • 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 已从 date 模块的公共 API 中移除。

4.3.0

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

4.2.0

  • 将解析器(resolvers)编写为异步生成器(async generators)的功能已被移除。请改用控件插件(controls plugin)。
  • wp.components.AccessibleSVG 组件已被移除。请使用 wp.components.SVG 代替。
  • wp.editor.UnsavedChangesWarning 组件不再接受 forceIsDirty prop。
  • setActiveMetaBoxLocations 操作(action)(core/edit-post)已被移除。
  • initializeMetaBoxState 操作(action)(core/edit-post)已被移除。
  • wp.editPost.initializeEditor 不再返回一个对象。请使用 setActiveMetaBoxLocations 操作(action)(core/edit-post)来替代现有对象的 initializeMetaBoxes 函数。
  • setMetaBoxSavedData 操作(action)(core/edit-post)已被移除。
  • getMetaBoxes 选择器(selector)(core/edit-post)已被移除。请使用 getActiveMetaBoxLocations 选择器(selector)(core/edit-post)代替。
  • getMetaBox 选择器(selector)(core/edit-post)已被移除。请使用 isMetaBoxLocationActive 选择器(selector)(core/edit-post)代替。
  • 属性类型强制转换(Attribute type coercion)已被移除。省略源以通过序列化注释标记保留类型。
  • 传递给 wp.editor.mediaUpload 的 onFileChange 回调的对象中的 mediaDetails。请使用 media_details 属性代替。
  • wp.components.CodeEditor 已被移除。请直接使用 wp.codeEditor。
  • wp.blocks.setUnknownTypeHandlerName 已被移除。请使用 setFreeformContentHandlerName 和 setUnregisteredTypeHandlerName 代替。
  • wp.blocks.getUnknownTypeHandlerName 已被移除。请使用 getFreeformContentHandlerName 和 getUnregisteredTypeHandlerName 代替。
  • 可重用区块(Reusable blocks)数据 API 已被标记为实验性,因为它未来可能会发生变化。

4.1.0

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

4.0.0

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

3.9.0

  • RichText getSettings prop 已被移除。如果需要继续使用,可使用 unstableGetSettings prop。强烈不建议使用不稳定(Unstable)API,且它们可能在未经通知的情况下被移除。
  • RichText onSetup prop 已被移除。如果需要继续使用,可使用 unstableOnSetup prop。强烈不建议使用不稳定(Unstable)API,且它们可能在未经通知的情况下被移除。
  • wp.editor.getColorName 已被移除。请使用 wp.editor.getColorObjectByColorValue 代替。
  • wp.editor.getColorClass 已重命名。请使用 wp.editor.getColorClassName 代替。
  • 由 wp.editor.withColors 传递的颜色对象中的 value 属性已被移除。请使用 color 属性代替。
  • Subheading 区块已被移除。请使用 Paragraph 区块代替。
  • wp.blocks.getDefaultBlockForPostFormat 已被移除。

3.8.0

  • wp.components.withContext 已被移除。请使用 wp.element.createContext 代替。参见:https://react.dev/reference/react/createContext。
  • wp.coreBlocks.registerCoreBlocks 已被移除。请使用 wp.blockLibrary.registerCoreBlocks 代替。
  • wp.editor.DocumentTitle 组件已被移除。
  • getDocumentTitle 选择器(selector)(core/editor)已被移除。

3.7.0

  • wp.components.withAPIData 已被移除。请改用 Core Data 模块或直接使用 wp.apiFetch。
  • wp.data.dispatch("core").receiveTerms 已弃用。请使用 wp.data.dispatch("core").receiveEntityRecords 代替。
  • getCategories 解析器(resolver)已弃用。请使用 getEntityRecords 解析器(resolver)代替。
  • 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 已从 Block API 中移除。请改用 supports.alignWide。
  • wp.blocks.isSharedBlock 已被移除。请改用 wp.blocks.isReusableBlock。
  • fetchSharedBlocks action (core/editor) 已被移除。请改用 fetchReusableBlocks。
  • receiveSharedBlocks action (core/editor) 已被移除。请改用 receiveReusableBlocks。
  • saveSharedBlock action (core/editor) 已被移除。请改用 saveReusableBlock。
  • deleteSharedBlock action (core/editor) 已被移除。请改用 deleteReusableBlock。
  • updateSharedBlockTitle action (core/editor) 已被移除。请改用 updateReusableBlockTitle。
  • convertBlockToSaved action (core/editor) 已被移除。请改用 convertBlockToReusable。
  • getSharedBlock selector (core/editor) 已被移除。请改用 getReusableBlock。
  • isSavingSharedBlock selector (core/editor) 已被移除。请改用 isSavingReusableBlock。
  • isFetchingSharedBlock selector (core/editor) 已被移除。请改用 isFetchingReusableBlock。
  • getSharedBlocks selector (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 props 和 selectors。
  • wp.editor.MediaPlaceholder 组件的 onSelectUrl prop 已重命名为 onSelectURL。
  • wp.editor.UrlInput 组件已重命名为 wp.editor.URLInput。
  • Text Columns 区块已被移除。请改用 Columns 区块。
  • InnerBlocks 分组布局已移除。请改用中间嵌套的内部区块作为替代方案。参考实现请见 Columns / Column 区块。
  • RichText 显式 element 格式已移除。请改用兼容的 children 格式。

3.4.0

  • Popover 组件中的 focusOnMount prop 已从仅接受 Boolean 更改为枚举风格属性,可接受 "firstElement"、"container" 或 false。请将任何 <Popover focusOnMount /> 用法转换为 <Popover focusOnMount="firstElement" />。
  • wp.utils.keycodes 实用工具已移除。请改用 wp.keycodes。
  • edit 函数中的区块 id prop 已移除。请改用区块 clientId prop。
  • property source 已移除。请改用等效的 text、html 或 attribute source,或者使用注释属性。

3.3.0

  • useOnce: true 已从 Block API 中移除。请改用 supports.multiple: false。
  • 序列化组件时使用 componentWillMount 生命周期方法。请改用构造函数。
  • blocks.Autocomplete.completers filter 已移除。请改用 editor.Autocomplete.completers。
  • blocks.BlockEdit filter 已移除。请改用 editor.BlockEdit。
  • blocks.BlockListBlock filter 已移除。请改用 editor.BlockListBlock。
  • blocks.MediaUpload filter 已移除。请改用 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 selector 已移除。请改用 getInserterItems。
  • getSupportedBlocks selector 已移除。请改用 canInsertBlockType。

3.1.0

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

3.0.0

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

2.8.0

  • wp.components.Autocomplete 中原来的自动补全接口已更新。请改用最新的自动补全接口。更多信息请参阅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.* 匹配器已移除。请改用声明性属性。更多信息请参阅block attributes。
  • wp.data.select( 'selector', ...args ) 已移除。请改用 wp.data.select( reducerKey' ).*。
  • wp.blocks.MediaUploadButton 组件已移除。请改用 wp.blocks.MediaUpload 组件。