Make WordPress Core

Changeset 33054


Ignore:
Timestamp:
07/02/2015 10:31:58 PM (9 years ago)
Author:
obenland
Message:

Use get_default_comment_status() globally.

Also makes the filter name static and passes the post type for context.

Props valendesigns.
Fixes #31168.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r32800 r33054  
    611611        $post->to_ping = '';
    612612        $post->pinged = '';
    613         $post->comment_status = get_option( 'default_comment_status' );
    614         $post->ping_status = get_option( 'default_ping_status' );
     613        $post->comment_status = get_default_comment_status( $post_type );
     614        $post->ping_status = get_default_comment_status( $post_type, 'pingback' );
    615615        $post->post_pingback = get_option( 'default_pingback_flag' );
    616616        $post->post_category = get_option( 'default_category' );
  • trunk/src/wp-admin/post.php

    r32654 r33054  
    130130    check_admin_referer( 'add-' . $post->post_type );
    131131
    132     $_POST['comment_status'] = get_option( 'default_comment_status' );
    133     $_POST['ping_status'] = get_option( 'default_ping_status' );
     132    $_POST['comment_status'] = get_default_comment_status( $post->post_type );
     133    $_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
    134134
    135135    edit_post();
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r32993 r33054  
    48104810                        break;
    48114811                    default:
    4812                         $comment_status = get_option('default_comment_status');
     4812                        $comment_status = get_default_comment_status( $post_type );
    48134813                        break;
    48144814                }
     
    48234823                        break;
    48244824                    default:
    4825                         $comment_status = get_option('default_comment_status');
     4825                        $comment_status = get_default_comment_status( $post_type );
    48264826                        break;
    48274827                }
    48284828            }
    48294829        } else {
    4830             $comment_status = get_option('default_comment_status');
     4830            $comment_status = get_default_comment_status( $post_type );
    48314831        }
    48324832
     
    48414841                        break;
    48424842                    default:
    4843                         $ping_status = get_option('default_ping_status');
     4843                        $ping_status = get_default_comment_status( $post_type, 'pingback' );
    48444844                        break;
    48454845                }
     
    48534853                        break;
    48544854                    default:
    4855                         $ping_status = get_option('default_ping_status');
     4855                        $ping_status = get_default_comment_status( $post_type, 'pingback' );
    48564856                        break;
    48574857                }
    48584858            }
    48594859        } else {
    4860             $ping_status = get_option('default_ping_status');
     4860            $ping_status = get_default_comment_status( $post_type, 'pingback' );
    48614861        }
    48624862
     
    51215121                        break;
    51225122                    default:
    5123                         $comment_status = get_option('default_comment_status');
     5123                        $comment_status = get_default_comment_status( $post_type );
    51245124                        break;
    51255125                }
     
    51345134                        break;
    51355135                    default:
    5136                         $comment_status = get_option('default_comment_status');
     5136                        $comment_status = get_default_comment_status( $post_type );
    51375137                        break;
    51385138                }
     
    51505150                        break;
    51515151                    default:
    5152                         $ping_status = get_option('default_ping_status');
     5152                        $ping_status = get_default_comment_status( $post_type, 'pingback' );
    51535153                        break;
    51545154                }
     
    51625162                        break;
    51635163                    default:
    5164                         $ping_status = get_option('default_ping_status');
     5164                        $ping_status = get_default_comment_status( $post_type, 'pingback' );
    51655165                        break;
    51665166                }
  • trunk/src/wp-includes/post.php

    r33041 r33054  
    41124112     * @param string $status       Default status for the given post type,
    41134113     *                             either 'open' or 'closed'.
     4114     * @param string $post_type    Post type. Default is `post`.
    41144115     * @param string $comment_type Type of comment. Default is `comment`.
    41154116     */
    4116     return apply_filters( "get_{$post_type}_default_comment_status", $status, $comment_type );
     4117    return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type );
    41174118}
    41184119
Note: See TracChangeset for help on using the changeset viewer.