boolesrings/Simple-Mathjax-wordpress-plugin

should the configuration be injected differently?

Opened this issue · 2 comments

pkra commented

Responding to https://wordpress.org/support/topic/problem-with-inline-equations/

made me look at

add_action('wp_head','SimpleMathJax::configure_mathjax',1);
add_action('wp_enqueue_scripts', 'SimpleMathJax::add_mathjax');

and this got me wondering if perhaps the configuration should also hook into wp_enqueue_scripts rather than wp_head.

cc @christianp @scoskey.

wp_enqueue_scripts doesn't happen at the point that the script tags are produced, it's just used to set up the queue of script URLs that should be used. Since the configuration script is defined inside the script tag instead of being loaded from a URL, we can't set it up there.

pkra commented

Thanks, @christianp. My wordpress knowledge has degraded significantly in the past few years.

If anyone knows of a better way to handle the injection of the configuration, please leave a comment.