Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#20912 closed defect (bug) (worksforme)

Php Notice for autosave in DEBUG mode when disabling autosave

Reported by: Marble23 Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.3.2
Component: Autosave Keywords: close
Focuses: Cc:


If you turn off autosave in your theme functions file, for example

function disable_auto_save(){
add_action( 'wp_print_scripts', 'disable_auto_save' );

set DEBUG to true you get an undefined index error in class.wp-scripts.php on line 155.

Its easily fixed if you check for the index:

-		if ( isset($this->registered[$handle]) && $this->registered[$handle]->args === 1 )
+		if ( $this->registered[$handle]->args === 1 )

Attachments (1)

20912.patch (518 bytes) - added by SergeyBiryukov 6 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
6 years ago

  • Component changed from General to Autosave

Uploaded the patch, but then realized that wp_print_scripts might not be the proper hook to disable autosave. Hooking into init with a later priority works without a notice.

#2 @azaozz
6 years ago

  • Keywords close added

Autosave performs several tasks on the edit/write screen, not a good idea to disable it by removing the script. If the purpose is to stop saving post revisions, there's a constant for that.

#3 @nacin
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.