3.6 Missing functions
-
Greetings all.
Tried to upgrade to 3.6 from 3.5.2 this morning and received errors about a function not existing or being invalid:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_show_post_preview' not found or invalid function name in /home/USER/.../wp-includes/plugin.php on line 406 Warning: Cannot modify header information - headers already sent by (output started at /home/develop/macrumors-web-admin/wp-includes/plugin.php:406) in /home/USER/.../wp-includes/pluggable.php on line 875
Sure enough, it doesn’t exist in 3.6. Along with that, here are some others that were found after manually adding _show_post_preview:
/** * Retrieve the format slug for a post * * @since 3.1.0 * * @param int|object $post A post * * @return mixed The format if successful. False if no format is set. WP_Error if errors. */ function get_post_format( $post = null ) { $post = get_post($post); if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) return false; $_format = get_the_terms( $post->ID, 'post_format' ); if ( empty( $_format ) ) return false; $format = array_shift( $_format ); return ( str_replace('post-format-', '', $format->slug ) ); } function _show_post_preview() { if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) { $id = (int) $_GET['preview_id']; if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) wp_die( __('You do not have permission to preview drafts.') ); add_filter('the_preview', '_set_preview'); } } /** * Determines if the specified post is a revision. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param int|object $post Post ID or post object. * @return bool|int False if not a revision, ID of revision's parent otherwise. */ function wp_is_post_revision( $post ) { if ( !$post = wp_get_post_revision( $post ) ) return false; return (int) $post->post_parent; } /** * Gets a post revision. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses get_post() * * @param int|object $post Post ID or post object * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. * @param string $filter Optional sanitation filter. @see sanitize_post() * @return mixed Null if error or post object if success */ function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') { $null = null; if ( !$revision = get_post( $post, OBJECT, $filter ) ) return $revision; if ( 'revision' !== $revision->post_type ) return $null; if ( $output == OBJECT ) { return $revision; } elseif ( $output == ARRAY_A ) { $_revision = get_object_vars($revision); return $_revision; } elseif ( $output == ARRAY_N ) { $_revision = array_values(get_object_vars($revision)); return $_revision; } return $revision; } /** * Retrieve the autosaved data of the specified post. * * Returns a post object containing the information that was autosaved for the * specified post. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param int $post_id The post ID. * @return object|bool The autosaved data or false on failure or when no autosave exists. */ function wp_get_post_autosave( $post_id ) { if ( !$post = get_post( $post_id ) ) return false; $q = array( 'name' => "{$post->ID}-autosave", 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ); // Use WP_Query so that the result gets cached $autosave_query = new WP_Query; add_action( 'parse_query', '_wp_get_post_autosave_hack' ); $autosave = $autosave_query->query( $q ); remove_action( 'parse_query', '_wp_get_post_autosave_hack' ); if ( $autosave && is_array($autosave) && is_object($autosave[0]) ) return $autosave[0]; return false; } /** * Internally used to hack WP_Query into submission. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @param object $query WP_Query object */ function _wp_get_post_autosave_hack( $query ) { $query->is_single = false; } /** * Returns all revisions of specified post. * * @package WordPress * @subpackage Post_Revisions * @since 2.6.0 * * @uses get_children() * * @param int|object $post_id Post ID or post object * @return array empty if no revisions */ function wp_get_post_revisions( $post_id = 0, $args = null ) { if ( ! WP_POST_REVISIONS ) return array(); if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) ) return array(); $defaults = array( 'order' => 'DESC', 'orderby' => 'date' ); $args = wp_parse_args( $args, $defaults ); $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) ); if ( !$revisions = get_children( $args ) ) return array(); return $revisions; }
Is anyone else having these errors? Some of these were found in revision.php but not all. Not a very graceful upgrade.
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘3.6 Missing functions’ is closed to new replies.