CPT support + custom TinyMCE locations
As per: https://wordpress.org/support/topic/script-not-loading-with-acf-wysiwyg-editor?replies=1#post-7454794
- [ ] Make sure Content Cards work with custom post types.
- [ ] See if we can support the most common use cases of TinyMCE outside the post editor:
- [ ] In ACF (on posts)
- [ ] In ACF (on settings pages)
- [ ] In the Black Studio TinyMCE Widget plugin
yeah, I am looking into that, too.
As for CPT, Content Cards should already work in all of them. The problem is when wp_editor is loaded in unusual places (settings, tools, etc.) as now we load most of javascript only on post pages in WP Admin, due to this check:
if ( ! isset( get_current_screen()->id ) || get_current_screen()->base != 'post' ) {
return;
}
We need a better check if wp_editor() is being loaded.
I think I have a solution for this. Instead of using admin_enqueue_scripts hook, we should use wp_enqueue_editor hook to enqueue content-cards.js.This way it would be loaded every time wp_editor is loaded, even on front end. I'll implement and test it out later today.
Sounds awesome :+1:
But I see a different problem - if we use this not in a post context, there is no post_id to use for data cache'ing
@ideag Options table for storage perhaps? Wouldn't that also make it possible to share cache if multiple pages embed the same URL?
@khromov hmm, I discarded idea of storage in optionsearly on, and chose postmeta because postmeta has internal gabage collection (gets deleted when the post gets deleted). And because of possibility that the same url is used on several posts, gabage collection would be tricky in options table.