Skip to content

Commit

Permalink
Plugin: Require includes for deprecated use_block_editor_for_ funct…
Browse files Browse the repository at this point in the history
…ions (WordPress#14096)

* Plugin: Fix 5.1.0 deprecated functions to correct plugin version

* Plugin: Require includes for deprecated `use_block_editor_for_` functions
  • Loading branch information
aduth authored and avillegasn committed Feb 27, 2019
1 parent 10c5034 commit 96c3ac0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ function gutenberg_collect_meta_box_data() {
* Return whether the post can be edited in Gutenberg and by the current user.
*
* @since 0.5.0
* @deprecated 5.0.0 use_block_editor_for_post
* @deprecated 5.1.0 use_block_editor_for_post
*
* @param int|WP_Post $post Post ID or WP_Post object.
* @return bool Whether the post can be edited with Gutenberg.
*/
function gutenberg_can_edit_post( $post ) {
_deprecated_function( __FUNCTION__, '5.0.0', 'use_block_editor_for_post' );
_deprecated_function( __FUNCTION__, '5.1.0', 'use_block_editor_for_post' );

require_once ABSPATH . 'wp-admin/includes/post.php';
return use_block_editor_for_post( $post );

}

/**
Expand All @@ -44,14 +44,15 @@ function gutenberg_can_edit_post( $post ) {
* REST API, then the post cannot be edited in Gutenberg.
*
* @since 1.5.2
* @deprecated 5.0.0 use_block_editor_for_post_type
* @deprecated 5.1.0 use_block_editor_for_post_type
*
* @param string $post_type The post type.
* @return bool Whether the post type can be edited with Gutenberg.
*/
function gutenberg_can_edit_post_type( $post_type ) {
_deprecated_function( __FUNCTION__, '5.0.0', 'use_block_editor_for_post_type' );
_deprecated_function( __FUNCTION__, '5.1.0', 'use_block_editor_for_post_type' );

require_once ABSPATH . 'wp-admin/includes/post.php';
return use_block_editor_for_post_type( $post_type );
}

Expand Down Expand Up @@ -155,23 +156,23 @@ function gutenberg_bulk_post_updated_messages( $messages ) {
* Injects a hidden input in the edit form to propagate the information that classic editor is selected.
*
* @since 1.5.2
* @deprecated 5.0.0
* @deprecated 5.1.0
*/
function gutenberg_remember_classic_editor_when_saving_posts() {
_deprecated_function( __FUNCTION__, '5.0.0' );
_deprecated_function( __FUNCTION__, '5.1.0' );
}

/**
* Appends a query argument to the redirect url to make sure it gets redirected to the classic editor.
*
* @since 1.5.2
* @deprecated 5.0.0
* @deprecated 5.1.0
*
* @param string $url Redirect url.
* @return string Redirect url.
*/
function gutenberg_redirect_to_classic_editor_when_saving_posts( $url ) {
_deprecated_function( __FUNCTION__, '5.0.0' );
_deprecated_function( __FUNCTION__, '5.1.0' );

return $url;
}
Expand All @@ -181,13 +182,13 @@ function gutenberg_redirect_to_classic_editor_when_saving_posts( $url ) {
* the editor from which the user navigated.
*
* @since 1.5.2
* @deprecated 5.0.0
* @deprecated 5.1.0
*
* @param string $url Edit url.
* @return string Edit url.
*/
function gutenberg_revisions_link_to_editor( $url ) {
_deprecated_function( __FUNCTION__, '5.0.0' );
_deprecated_function( __FUNCTION__, '5.1.0' );

return $url;
}
Expand Down

0 comments on commit 96c3ac0

Please sign in to comment.