How to load a php or javascript file in a wordpress post

This is a short tutorial how to include a php or javascript file directly in a wordpress post.

Include a php or javascript file into a wordpress post

Step 1: Upload the file into your theme folder or a subfolder
Step 2: Use a plugin like Allow PHP in posts and pages (even if it’s outdated it works fine)
Step 3: Copy this line of code and save it as a new snippet in the Allow PHP plugin (remove the php quotes before and after). Replace the link with your correct folder path.

<?php include("mywebsite.com/wp-content/plugins/test.php"); ?>

That’s it, just simple!

Any questions to this?

Drop a comment. 🙂

Leave a Reply

avatar
wpDiscuz