Relative URLs are best avoided in WP, so use absolute URLs instead. Also, you should load javascript files using the correct method, ie by using the wp_enqueue_script()
function hooked to the wp_enqueue_scripts
action hook. Doing both of these things will sort out your issue. Using wp_enqueue_script()
will also allow you to define dependencies so, for example, you don’t load jQuery twice (in the event the theme or another plugin is already loading it). The page I linked to shows an example of the code you need.
Related Posts:
- Category links suddenly started giving 404 errors
- Get term by slug in Gutenberg
- Any way to assign Post Categories and Tags to Links?
- How to add custom script to the particular Product Category page
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- How to enable category hierarchy for links?
- Combining post categories and link categories?
- Displaying a full post instead of a slug per category?
- Link Attachment Image to Category
- Class active for Archive link – looped out
- Why do my categories redirect?
- Get category url in loop
- wp_dropdown_categories() scripts working erratically on sidebar
- Older entries link within category page
- Style category link depending on category ID
- REST API: Display Category names in JSON?
- wp_dropdown_categories not showing option as selected
- Get paged category link programmatically
- Link To Child Category For A Post
- How to not display a category post on blog page?
- Link from navbar to categories
- wp_insert_link not working
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- ADD DYNAMIC attribute for category to accordion
- How to check a category checkbox using JavaScript
- Show Subcategory Name Instead of Parent Category
- Link For Portfolio Categories
- How to get the link of all categories
- Featured image for links and categories
- Categories as selectable links on submission form
- Javascript code for Category
- Displaying categories and subcategories without link
- How to get category slug link? ( include parent categories)
- Can’t filter categories using isotope
- Can I set a default featured image for a category?
- What’s the URL for a category archive?
- Weird behaviour when adding terms/term_taxonomies programmatically
- how to use a different domain/subdomain for authors/catagories on single site?
- How to append a URL parameter to all outbound URLs
- Category count inside the link
- Is there a way to have duplicate category slugs?
- Multiple level category drop-down
- Remove “Parent” Selection When Adding/Editing Categories?
- Show post only if match all categories
- Output link to category from WP_Query loop of woocommerce products
- How to get product count with respect to categories in WooComerce
- Password protect a specific category page/post
- Different excerpt styles per category, but chronological
- Show only one category
- Pagination Not Working on Category.php page
- Filter Home Page Posts in Buddypress [closed]
- Broken category pagination
- Additional featured post on first page
- Color different for the current category
- one category template for multiple categories
- How do I toggle pagination on/off in search results and category listings via a link?
- Category shows only top level child categories
- List categories with custom code
- Page display certain Category Posts
- Where is the category of a post stored?
- Add image to each podcast series (or category) in headless WordPress instance [closed]
- How to define multi categories posts number
- Trying to get variables in hacked category dropdown
- how to separate categories in loop.php?
- Change of category structure will cause two kinds of URLs for one post
- Insert HTML content in WP Query at specific point
- Change slug of Standard wp Post category
- Get posts of a custom post type from category from taxonomy?
- How can I ask to an existing category?
- Hide a category of posts from main blog, and only show in category view
- ACF no print data [closed]
- Change categories count to include media attachments
- How to Sync Menu, Widgets and other masters from Main Website to its Sub Site
- Archive filtering
- How can I check which archive has referred the single? [closed]
- How to hide widget from certain category
- How can I use AJAX with check-box categories?
- wp_delete_term or wp_delete_category?
- Get post content intro text on category.php?
- List Categories By Specified First Character
- the category city made as a subdomain
- wp_get_post_categories not work currently on loop.php
- Inline If statement to echo CSS [closed]
- Get category base permalink
- WooCommerce showing active product categories on single product page
- how to exclude specific category types (uncategorized) from blog page?
- Show subcategory name selected in specific category woocoommerce
- Confused about category.php template – not working
- Style a category page the same way as the homepage?
- Display Taxonomies in loop with template args
- How to assign image on specified category and not show the image on other categories
- How can I add a Categories page link to a menu? [closed]
- Way to show content of a post, but if exceeds character limit revert to excerpt?
- get posts from 2 categories. (2 posts)
- How to add location as category?
- Converting Categories (with ACF fields) to custom taxonomies
- Function to reference post meta in place of category Woocommerce
- hide_empty property not working when using get_terms
- Category Redirection Problem
- Hierarchical outline of posts