Insert PHP include into Page

I have tried a few plugins and can’t seem to find one that works for a simple PHP include into my WordPress page. Does anybody have any recommendations? And is there a reason that WordPress doesn’t support PHP includes into pages via the WYSIWYG editor by default?

Thanks

The WYSIWYG editor restricts the type of code you can use for security reasons.

You would have to add the PHP include directly to the code in the page template you want to alter. Go to Appearance > Editor to find the template.

Just be aware that if you change the code in a theme, it will be over-written the next time an update for the theme becomes available and you update it. You will lose all your changes then. If you want to change the theme’s code, you should really use a child theme.

The Page that I am posting to already uses a template. However, the SVG include needs to be within the content area of that template. So I believe I need to use the WYSIWYG.

Is there a PHP plugin that works with the latest version of WordPress for this?

Did you try searching the plugin repository on the WordPress site? There are a number of plugins listed there that might do the job: https://wordpress.org/plugins/search/Insert+PHP/

I don’t like to cross reference topics too much, but just for context, I believe the problem relates to this topic:-

But I think it appropriate to continue this discussion here, being a WP specific problem not directly related to html & css.

Could you make the php code you want to include into a template? Then this plugin: https://wordpress.org/plugins/improved-include-page/ might do the job for you. It seems to include a template inside another page or post.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.