How to get current category ID of the active page in wordpress

You can try using [crayon-5e8c12bd6aaad042504046-i/]: [crayon-5e8c12bd6aab4046968661/] One thing is more here… Looking to pull the category ID of a specific page in WordPress that is listing all posts using that specific category. Tried the below but not working. I am able to get the category name using single_term_title. [crayon-5e8c12bd6aab8698041634/] $category is displaying “Entertainment” for example. But

How to get WordPress path url in js script file

You could avoid hardcoding the full path by setting a JS variable in the header of your template, before [crayon-5e8c12bd6acab774119105-i/] is called, holding the template URL. Like: [crayon-5e8c12bd6acb3014359639/] And use that variable to set the background (I realize you know how to do this, I only include these details in case they helps others): [crayon-5e8c12bd6acb7792636946/]