Changeset 31201
- Timestamp:
- 01/16/2015 05:18:17 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r31119 r31201 2726 2726 global $post, $wp_scripts; 2727 2727 2728 if ( ! $post = get_post( (int) $_POST['post_ID'] ) ) { 2729 wp_send_json_error(); 2730 } 2731 2732 if ( empty( $_POST['shortcode'] ) || ! current_user_can( 'edit_post', $post->ID ) ) { 2733 wp_send_json_error(); 2734 } 2735 2736 setup_postdata( $post ); 2737 $shortcode = do_shortcode( wp_unslash( $_POST['shortcode'] ) ); 2738 2739 if ( empty( $shortcode ) ) { 2728 if ( empty( $_POST['shortcode'] ) ) { 2729 wp_send_json_error(); 2730 } 2731 2732 $shortcode = wp_unslash( $_POST['shortcode'] ); 2733 2734 if ( ! empty( $_POST['post_ID'] ) ) { 2735 $post = get_post( (int) $_POST['post_ID'] ); 2736 } 2737 2738 // the embed shortcode requires a post 2739 if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { 2740 if ( 'embed' === $shortcode ) { 2741 wp_send_json_error(); 2742 } 2743 } else { 2744 setup_postdata( $post ); 2745 } 2746 2747 $parsed = do_shortcode( $shortcode ); 2748 2749 if ( empty( $parsed ) ) { 2740 2750 wp_send_json_error( array( 2741 2751 'type' => 'no-items', … … 2757 2767 ob_start(); 2758 2768 2759 echo $ shortcode;2769 echo $parsed; 2760 2770 2761 2771 if ( 'playlist' === $_REQUEST['type'] ) {
Note: See TracChangeset
for help on using the changeset viewer.