Support » Developing with WordPress » Is the usage of wp_enqueue_scripts required for plugins?

  • Hi,

    I’m developing a maintenance mode plugin which will allow users to show a maintenance mode page for guest users.

    So I’m forcing a template from the plugin via template_redirect hook when maintenance mode is ON.

    My issue is that, having wp_head() and wp_footer() in my template causing big style issues from the themes and other active plugins. I’m thinking to remove both of them to avoid those conflicts.

    In that case, I will have to hard-code the <link rel="stylesheet"> tags inside my custom template file. Is it okay to do that way in this case? I have heard they will not approve my plugin if we don’t use wp_enqueue_scripts action to add stylesheets and javascript files to templates. Is that rule applicable to my case also?

    Appreciate any help.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I would expect so, but what do I know? 🙂 I suggest you contact one of the plugin review team members at the #pluginreview channel on Slack for a definitive answer.

    You should be able to enqueue your stylesheets using a very large priority number to practically ensure they are loaded last so your styles will take precedence over the equivalent styles enqueued by others using default or modest priorities.
    add_action('wp_enqueue_scripts', 'ÿmy_callback', PHP_INT_MAX );

    ÿ is unicode xff, the highest allowed variable letter. For callbacks using the same priority, the functions are rumored to be executed in alphabetical order, so function names beginning with ÿ should be the last ones called of all those with the same priority.

    Hi @bcworkz,

    Thanks for your helpful answer. Then I contacted the plugin review team via email and got the answer that they have an exception for coming soon plugins. Their reply was fast BTW. 🙂

    Thanks!
    Praboda.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is the usage of wp_enqueue_scripts required for plugins?’ is closed to new replies.