• Does anyone have any words of wisdom on the best way to include a non-WP PHP script in a WP-based site?

    The script is to be called from some Javascript, and output data that only has to be used by the Javascript. However, it would be handy if it did have secure access to some data from WP, for example the logged in user ID.

    My current idea is to write it as a template file within the theme directory, and base a page on that template – and then use the hide page plugin to make sure that that page does not show up in the menus. Don’t know if that will work with GET or POST arguments though. Advantage is that it can share common code e.g. object definitions with other pages in the same location, easily.

    Alternatively maybe locate it all in a script directory completely outside WP, and use session data to convey user IDs etc.

    Any thoughts? Is there a “right way” to do this?

  • The topic ‘Integrating a non-page-related PHP script’ is closed to new replies.