Why must this ajax call tie to the post-id of the post page containing the
shortcode to be rendered? Is it meant to soon have "symbolically-linked"
galleries and shortcodes that are linked to multiple post-ids, not just
embedded as shortcode in post_content? Or is there another reason for
requiring a post-id of a post the user can edit, not just "0", when
rendering playlist views?
action were hardcoded to look for an element with a certain id, #post_ID.
(in wp-includes/js/media-views.js, wp-includes/js/mce-view.js). While it
works well for the wp-admin pages as given by Wordpress, it seems it could
use a more generic item, like a property in whatever the current tinymce
editor is? What do you think?
On 27/08/2014 12:10 AM, Luke Bryan wrote:
> I was looking at the wp media shortcode and wp-views, and noticed a few
> things that seem not-too-portable in the view ajax and rendering:
> In ajax-actions.php of Wordpress 4.0 we see this render-and-return routine
> requiring a post_id of post the user can edit:
> Why must this ajax call tie to the post-id of the post page containing the
> shortcode to be rendered?
This is meant for rendering the previews for these shortcodes in wpView,
not for returning the HTML for arbitrary shortcodes.
As this happens only when a user is writing/editing a post, the AJAX
action requires the post_id and checks if the current user can actually
edit that post.