1. Home
  2. Docs
  3. Insert PHP Code Snippet
  4. FAQ
  5. How can I use the PHP snippet in my wordpress site?

How can I use the PHP snippet in my wordpress site?

First install the “Insert PHP Code Snippet” plugin in your wordpress site using the instructions in https://help.xyzscripts.com/docs/insert-php-code-snippet/installation/

Now go to the “XYZ PHP Code > PHPCode Snippets” section


Click the “Add new PHP Code snippet” button.


Here enter the “Tracking name”, “PHP code” and click the submit button.

Please note that don’t use the starting and closing php tag (<?php ?>)in the code.


The snippet is now ready to use and you can see the shortcode of the snippet.


Now when creating a new post/page, you can add the shortcode directly in the post content.


Also you can see all your snippets in the dropdown in the editor with name “PHP” as show below.


Here we can see all our snippets with the “Tracking Name” and select one. Then it will place the shortcode in the post.


Now update your post and the php code will run in your post.

Was this article helpful to you? Yes 10 No 10