It is required, actually.
There’s no real difference between themes and plugins as such. Neither of them should take actions on merely being loaded, they should use action hooks on functions to have things happen in the correct ordering.
Related Posts:
- Dequeue Scripts and Style for Mobile not working?
- Dequeue script in template isn’t working
- enqueue styles for only mobile wp
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Advanced method to control cache of enqueued style/script
- WordPress wp_dequeue_script remove all other scripts
- Test CDN link from function.php or wp_enqueue_script/style?
- Issues with title-tag and document_title_parts
- How to load scripts/styles specific for a page
- WordPress Enqueue for homepage only, functions.php, wp-framework
- Is it ok to use a function to output the text domain name in a wordpress theme
- Display random categories on the front page (Finding and Editing Theme Functions)
- How to get woocommerce inventory status [closed]
- TinyMCE custom styles remove class when switching styles
- deregister scripts on certain page
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Enqueue Script with data attributes
- How to enqueue every script in a folder automatically?
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Organize functions.php
- How to override functions.php in child theme?
- Overriding core functions in child theme
- Most elegant way to enqueue scripts in function.php with foreach loop
- Change parent theme file function in child themes functions.php
- wp_register_script not loading as expected
- Problem using is_single() to enqueue script from functions.php
- Add inline css to theme
- Enqueuing External Javascript functions.php
- How to enqueue JavaScript for specific WordPress pages only?
- Displaying Widgets
- Enqueue script o style only if a template part is loaded
- Enqueuing Script in functions.php vs on the page
- Add external js file to footer with id
- Changing itemprop from logo to image on custom logo?
- How to add background image control to page admin controls?
- Best Practice for Syncing Local Development With Staging Development [closed]
- Overwrite Parent Theme add_image_size in Child Theme
- Show excerpt for only first post in query
- How to add css class to image attached in all the posts?
- If is multiple page templates
- How do I get a child theme to load scripts from the parent theme?
- wp_enqueue_script add integrity parameter
- How to call custom function from functions.php in site-wide template files?
- How to use thumbnails in gallery?
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- Passing arguments to my function with do_action and add_action is not working
- Is there a way to add a class to non current menu item?
- Load JS Script only for custom post types
- How to use Internationalized human_time_diff() function in Chinese?
- is_dynamic_sidebar always returns true while using Jetpack visibility
- Enqueue scripts not working with if is page conditional tag in functions.php
- wp_is_mobile dequeue not working
- How to enable template page only for a post id page
- Register vendor JS/CSS only on pages that require them?
- Why won’t my scripts load?
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Add caption functionality to custom WordPress theme
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Override a theme function in a child theme?
- Pulling Twitter RSS feed not working as expected (fatal error)
- Not sure if enqueuing js scripts properly
- Only let plugin add actions to wp_head & wp_footer on single posts
- Register and load scripts
- Use register_setting() in a loop
- Best practices regarding the creation of custom widgets?
- Add dynamic links in WordPress custom theme
- WordPress menu link doesn’t work properly
- Search filter by Post title OR Meta Title Value [duplicate]
- how can I edit flexslider in woocommerce. [Urgent]
- admin-ajax.php + load-scripts.php hanging for minutes
- how to en-queue jQuery to load before the tag
- Jquery implementation not working on page reload
- Unique sequential reservation code
- Attempt to change jQuery version caused White Screen of Death
- Usage of theme name in functions
- Functions.php Problem
- jQuery does not work
- enqueue_script with filemtime javascript not working
- ACF not showing
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Control the srcset much more (not all sizes in it each time)
- Check if the image size is available and if not use ‘full’ image size
- Way to store featured image width and height in two separate variables?
- Remove Custuomize Sections
- Can we create our own theme’s function.php?
- add_action wp_enqueue_script priority level only works for admins
- Define PHP variable from a seperate API if statement
- Scripts not loading when using the wp_enqueue_scripts action
- Excerpt for pages not showing
- get_pages() Returns Only One Item
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- In jquery use php variable to execute an enqueued jquery file
- Enqueue script on every page except one
- Run a jquery script on on a certain template page
- Does size of a theme’s functions.php file matter?
- Functions php shortcode for displaying main menu with no child items
- get_next_posts_link() returns no result despite available posts
- Nav menus all outputting the same links