Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete code #7712

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions includes/class-sensei-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ public function __construct() {
// remove a course from course order when trashed
add_action( 'transition_post_status', array( $this, 'remove_trashed_course_from_course_order' ) );

// Add workaround for block editor bug on CPT pages. See the function doc for more information.
add_action( 'admin_footer', array( $this, 'output_cpt_block_editor_workaround' ) );

// Add AJAX endpoint for event logging.
add_action( 'wp_ajax_sensei_log_event', array( $this, 'ajax_log_event' ) );

Expand Down Expand Up @@ -1749,44 +1746,6 @@ public function notify_if_admin_email_not_real_admin_user() {
}
}

/**
* Adds a workaround for fixing an issue with CPT's in the block editor.
*
* See https://github.com/WordPress/gutenberg/pull/15375
*
* Once that PR makes its way into WP Core, this function (and its
* attachment to the action in `__construct`) can be removed.
*
* @access private
*
* @since 2.1.0
*/
public function output_cpt_block_editor_workaround() {
$screen = get_current_screen();

if ( ! ( method_exists( $screen, 'is_block_editor' ) && $screen->is_block_editor() ) ) {
return;
}

?>
<script type="text/javascript">
jQuery( document ).ready( function() {
if ( wp.apiFetch ) {
wp.apiFetch.use( function( options, next ) {
let url = options.path || options.url;
if ( 'POST' === options.method && wp.url.getQueryArg( url, 'meta-box-loader' ) ) {
if ( options.body instanceof FormData && 'undefined' === options.body.get( 'post_author' ) ) {
options.body.delete( 'post_author' );
}
}
return next( options );
} );
}
} );
</script>
<?php
}

/**
* Attempt to log a Sensei event.
*
Expand Down
Loading