So basically I made a php file that is called with two arguments (order total and order number) and it spits out a png with an EPC QR Code (so people just scan it and their banking app fills in all the details).

This file works in an empty virtual host, but it won't work when I put it anywhere in a wordpress directory/virtual host.

Is there some setting somewhere that is keeping non-wordpress php files from executing?

  • Welcome to WPSE. Don't forget to take the tour and check our help documentation. This is a great first question BTW. – Matthew Brown aka Lord Matt Sep 2 at 1:03

Yes. The default WordPress .htaccess file. Without edits, all calls are redirected to index.php.

Your best bet is to pass the call through WordPress as a custom plugin. This answer deals with setting up a REST endpoint. Of course, that means returning JSON which might not be exactly what you are looking for.

Another approach might be to edit the .htaccess file.

Something like this, near the top:

RewriteRule my-qr-code.php$ - [L]

This tells the server that in this case, if the file matches, we are done. That solution comes from a StackOverflow question.

  • 1
    thanks a lot!! =) – Viktor Gruber Sep 2 at 13:11
  • My pleasure. If my answer was helpful to you please consider up-voting it. If my answer completely solved your problem, please consider accepting it so other people know a complete solution can be found here. – Matthew Brown aka Lord Matt Sep 2 at 15:21
  • 1
    I accepted it, and I would have upvoted it, but I am lacking in reputation to do that. – Viktor Gruber Sep 2 at 18:42
  • Fair enough. I had forgotten you have to wait for +15 rep. That was a long time ago for me. Keep going, you'll get there soon enough. – Matthew Brown aka Lord Matt Sep 2 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.