Fix WordPress Plugin Hide-Title Fails Updating Posts & Pages

Problem: Update post or page fails to complete or remains blank

This hack worked in the following situation. Other versions of WordPress and Hide-Title plugin might also benefit.

Situation:

  • Running WordPress 3.5.1 in subdomain Network mode
  • WordPress plugin Hide-Title, by┬áDojo Digital, version 1.0.3 (current as of Mar, 2013)
  • Backup option “Save to server” works normally

Symptoms:

  • Update post or page appears to fail to complete, page remains blank
  • Running in WP_DEBUG mode reveals notices and warnings
  • Notice: Undefined index: dojodigital_toggle_title in …/wp-content/plugins/hide-title/dojo-digital-hide-title.php on line 157
  • Warning: Cannot modify header information – headers already sent by (output started at …/wp-content/plugins/hide-title/dojo-digital-hide-title.php:157) in …/wp-includes/pluggable.php on line 876

The Hack:

  • File: /…/wp-content/plugins/hide-title/dojo-digital-hide-title.php
  • Function: on_save(), near line 150
  • Test for the existence of $_POST[ $this->slug ] before attempting to use it
  • Provides better fall back error handling in this case
  • Replace the following two lines
$old = get_post_meta( $postID, $this->slug, true );
$new = $_POST[ $this->slug ] ;
  • with these lines
 $old = get_post_meta( $postID, $this->slug, true );
 #start flail
 #$this->slug == 'dojodigital_toggle_title'
 $new = empty( $_POST[ $this->slug ] ) ? NULL : $_POST[ $this->slug ];
 #end flail
 #$new = $_POST[ $this->slug ] ;

Ensure the offending line above, “$new = $_POST[ $this->slug ] ;” is commented out with # or //

Leave a comment

Your email address will not be published. Required fields are marked *

33 + = 39