Make WordPress Core


Ignore:
Timestamp:
09/04/2012 04:29:28 PM (12 years ago)
Author:
ryan
Message:

Use get_post() instead of global $post.
Make the $post argument to get_post() optional, defaulting to the current post in The Loop.

Props nacin
see #21309

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-editor.php

    r21664 r21735  
    127127
    128128    public static function editor_settings($editor_id, $set) {
    129         global $editor_styles, $post;
     129        global $editor_styles;
    130130        $first_run = false;
    131131
     
    371371            $body_class = $editor_id;
    372372
    373             if ( isset($post) )
    374                 $body_class .= " post-type-$post->post_type";
     373            if ( $post = get_post() )
     374                $body_class .= ' post-type-' . $post->post_type;
    375375
    376376            if ( !empty($set['tinymce']['body_class']) ) {
     
    613613
    614614    public static function wp_fullscreen_html() {
    615         global $content_width, $post;
     615        global $content_width;
     616        $post = get_post();
    616617
    617618        $width = isset($content_width) && 800 > $content_width ? $content_width : 800;
Note: See TracChangeset for help on using the changeset viewer.