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
- How to get category and archive title?
- How can I create a category landing page followed by pages of posts?
- How to search for categories and/or tags?
- How to create a category and sub-category sorted blogroll with all posts?
- How to split the categories of subcategories with thumbnails
- Add custom category name as data-filter to switch between these categories
- Get all the blog’s categories and the related URLs?
- Update taxonomy value of post type in query
- Is it possible to add short code and html tag in Category Description?
- How do I specify more than one category?
- Making a tourism information website [closed]
- Adding Categories Through Function
- WordPress search only showing a few posts
- How to recreate a copy of a product category in WooCommerce? [closed]
- Multiple category archive page
- List subcategories of active parent category (WooCommerce)
- How to display post type and category links in foreach WordPress code
- Add multiple classes. Different style for each category tag
- How to build a simple nav system of custom post type categories and its posts?
- Custom Walker for wp_list_categories
- How to insert category list into post creation page, and retrieve chosen categories?
- Output category color option to each li item
- How do I display only two categories Instead of displaying all categories
- Hooking to walker_nav_menu_start_el to insert list of subpages
- Having problems with paging
- How do I add a tag slug to a category URL to filter posts?
- Dropdown menu for subcategories
- Adding custom ID field to the categories
- Child Category Conditional Question
- get category name in admin screen
- Return category posts with WP_Query
- Subcategory Page URL to Display Only Posts from that Subcategory?
- Setting the Primary Category for a Post Based on Context
- Show the number of the post
- Automatically adding tags and categories into Post Excerpt for searching
- Allow Custom Role to edit a custom post type category
- Shop Category Pages missing s
- How to prevent tag “iframe” from being deleted from the heading description of rubric?
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- How do I merge WooCommerce categories with the same name?
- Custom get_the_password_form
- How can I make a category function as a page?
- How to add custom option to wp_dropdown_categories?
- How to hide/remove featured images in particular categories post?
- Create duplicate category page with content variations
- Renaming default category taxonomy?
- Profiling user with categories
- Category names dependent on each other?
- Hide category name in URL
- Category archives
- Loop Through Categories in Custom Field
- Backend – Categories and Menus conflicts
- Highlight posts that belong to current sub category
- How to add an empty entry to masonry?
- Own Custom Tags/Category page ( posts)
- finding out the top 5 source ( source is a custom taxonomy ), in a given category
- How to display many photo albums related to category
- Modify functions.php to add a term ‘uses-theme’ set to theme name on post save
- Create custom Perma link
- how to implement next/prev within category archive?
- Add product category to post_class
- Moving Blog and Changing URL
- hide_empty property not working when using get_terms
- Category Redirection Problem
- Hierarchical outline of posts
- I am looking for a function to create category links in the wordpress loop for articles