wp-shortcake / shortcake

Shortcake makes using WordPress shortcodes a piece of cake.
GNU General Public License v2.0
665 stars 143 forks source link

Allow to filter query_args in post_select ajax call #744

Open ivankristianto opened 7 years ago

ivankristianto commented 7 years ago

I add post id to the post_select ajax call, then a allow to alter the query args for more extendability.

This will solve my issue that return the post list based on which post type it's currently editing. and it also can fix this issue #625

goldenapples commented 7 years ago

I can see how this would be useful, but - since editors containing shortcodes can appear in more places than just on a post edit screen - I think we might need to figure out a more abstract way of representing the context of the current editor, which then can be passed into queries like ajax call for 'post_select' fields.

I have a branch started locally trying to address this for #661 which I need to polish up. I'll see if it can work well with what you have here.

Finally, it might be good to see the javascript logic live inside the parent class editAttributeSelect2Field, rather than in editAttributeFieldPostSelect, so that we can make use of the same filters for user select and term select fields?

ivankristianto commented 7 years ago

Thanks @goldenapples interested to see how you did the abstraction. And yes, I agree with you to move the postId arg to parent class. PR updated.

ivankristianto commented 7 years ago

@goldenapples lol i didn't realize that either. I updated the PR