PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 10, 2022

[FIXED] file_get_contents(includes_url( '/js/jquery/jquery.js' )); not working

 February 10, 2022     php, wordpress     No comments   

Issue

Hello I want to get the contents from the local jquery path in my wordpress theme. I am doing the following code:

$jq = file_get_contents(includes_url( '/js/jquery/jquery.js' ));

when I echo out the variable jq there is nothing stored in it

echo $mergedJs; // nothing

This only happens when I upload the theme to the server,it works fine on my local which is odd.

Any suggestions?

Thanks!


Solution

I figured it out, I had to change

$jq = file_get_contents(includes_url( '/js/jquery/jquery.js' ));

to

$jq = file_get_contents(ABSPATH . WPINC . '/js/jquery/jquery.js');

and it worked. I'd be interested to know why this works, and the old one doesn't.



Answered By - cup_of
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing