Make WordPress Core


Ignore:
Timestamp:
05/10/2014 11:35:08 PM (11 years ago)
Author:
wonderboymusic
Message:

First pass at wpview logic for the [embed] shortcode. URLs on a their own line are parsed as well. The toolbar will appear with the "remove" button when the view is clicked. Edit has not been implemented yet.

Props avryl, wonderboymusic.
See #28195.

File:
1 edited

Legend:

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

    r28356 r28358  
    25072507    wp_send_json_success( $api );
    25082508}
     2509
     2510/**
     2511 * Apply `the_content` filters to a string based on the post ID.
     2512 *
     2513 * @since 4.0.0
     2514 */
     2515function wp_ajax_filter_content() {
     2516    global $post;
     2517
     2518    if ( ! $post = get_post( (int) $_REQUEST['post_ID'] ) ) {
     2519        wp_send_json_error();
     2520    }
     2521
     2522    if ( ! current_user_can( 'read_post', $post->ID ) ) {
     2523        wp_send_json_error();
     2524    }
     2525
     2526    setup_postdata( $post );
     2527
     2528    wp_send_json_success( apply_filters( 'the_content', wp_unslash( $_POST['content'] ) ) );
     2529}
Note: See TracChangeset for help on using the changeset viewer.