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
- WordPress Enqueue for homepage only, functions.php, wp-framework
- Display random categories on the front page (Finding and Editing Theme Functions)
- How to get woocommerce inventory status [closed]
- 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
- Organize functions.php
- How to override functions.php 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
- Problem using is_single() to enqueue script from functions.php
- 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?
- 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?
- How to call custom function from functions.php in site-wide template files?
- Is there a way to add a class to non current menu item?
- Load JS Script only for custom post types
- Enqueue scripts not working with if is page conditional tag in functions.php
- How to enable template page only for a post id page
- 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
- Not sure if enqueuing js scripts properly
- Best practices regarding the creation of custom widgets?
- Jquery implementation not working on page reload
- Usage of theme name in functions
- enqueue_script with filemtime javascript not working
- ACF not showing
- Check if the image size is available and if not use ‘full’ image size
- Remove Custuomize Sections
- Can we create our own theme’s function.php?
- Define PHP variable from a seperate API if statement
- get_pages() Returns Only One Item
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- In jquery use php variable to execute an enqueued jquery file
- Run a jquery script on on a certain template page
- wp_enqueue_script | Help me figure out what is causing jQuery is not defined
- Theme JS is available but theme CSS isn’t
- Getting the teaser text without overriding global variables
- How to load jQuery in TOP of wp_footer?
- “options.php” not found
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- What is the correct way to include my new functions and scripts in WordPress?
- Include Jquery libraries in wordpress theme?
- wp_nav_menu work in functions.php but not in the theme
- Problem enqueuing scripts on not single posts
- Call two different function.js depending on page
- contact form in template with jquery,validate and ajax
- Enqueueing scripts selectively & activation where needed
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Exclude specific post from query
- Is it possible to load recaptcha script only in url with fragment identifier (#)?
- Why does echo on functions.php not yield result in source code?
- Why does my wp_enqueue_script() only insert the script for logged in users
- WP Enqueue Script Error
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to retrieve image IDs from shortcode content?
- I need to ‘wp_dequeue_script’ and ‘styles’ and ADD a bunch of other css and js
- I need to completely ‘wp_dequeue_script’; what’s the best way?
- Class::$template_dir_path=get_template_directory();
- True parameter but jquery register in header and not in the footer with wp_register_script
- Why is style.css not loading through the functions.php
- Different body image backgrounds on different pages, posts and categories
- How to wp_enqueue_script with html?
- wordpress not calling peliegro functions.php?
- Language switcher for subdomains
- custom post with loading script per single post
- wp_enqueue_script only works outside of action
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- wp_nav_walker that interacts with widgets to setup mega menu
- java script error Uncaught SyntaxError: Unexpected token ILLEGAL
- Allow tags and attributes in post and pages content
- using enqueue_script in a shortcode isn’t working
- enqueue script if page is not equal to
- wp_enqueue_scripts called twice?
- Add the title of a widget as an ID – for anchor links
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- How to get postId from the argument $block when register_block_type()?
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- Auto updating JavaScript dependancy in functions.php
- wp_script_add_data not working
- Setcookie not setting cookies anywhere except admin