Fail: function update_post_meta()

This is one of the best I have seen in a while. In this plugin the author has used a lot of very poor function names, such as output_meta(), print_metabox_styles(), and post_meta_box(), but there is one that takes the cake: update_post_meta()

The author decided it was a good idea to define their own update_post_meta() function that does what? Calls the main update_post_meta() function defined by WordPress core:

function update_post_meta( $post_ID ) {
	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; }
	if ( isset( $_POST['_keywords'] ) ) {
		$post_keywords = stripslashes_deep( $_POST['_keywords'] );
		update_post_meta( $post_ID, '_keywords', $post_keywords );
	}
	if ( isset( $_POST['_description'] ) ) {
		$post_keywords = stripslashes_deep( $_POST['_description'] );
		update_post_meta( $post_ID, '_description', $post_keywords );
	}
}
Advertisements

8 thoughts on “Fail: function update_post_meta()

  1. I’m stunned they spent the time on this, when searching for any combination of WordPress, autosave, disable, revisions would show a much easier copy-paste:

    function disableAutoSave(){
    wp_deregister_script(‘autosave’);
    }
    add_action( ‘wp_print_scripts’, ‘disableAutoSave’ );

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s