I am trying to finish my first WordPress plugin. I've managed to create the admin part, where I load a lot of information into custom tables I've created on the same database as the WP installation, that part works fine.

But now I need the plugin to create a page that shows that information to the users, and I don't know how to face it, can you point me in the right direction?

I want the plugin to create a page named 'courses' or something like that on activation, and when users access that URL it displays the info from that table.


My first response when I hear "custom tables" is - are you absolutely certain you need custom tables rather than using custom post types, post meta data, and custom taxonomies? Far fewer wheels to reinvent by going that route.

That said, to integrate data into any theme, a couple of options are to either create a Shortcode to inject your data into the content area, or add a filter to the_content, where you can check if it's your courses page, and inject your data into the content area.

Rather than add a page automatically, I would give users the option to select a page they want to use for display. If you do indeed want to add a page, you can use wp_insert_post to generate one.

  • It's quite a wide table, so i don't want sidebar or comment box to appear, only the table, that's why i ask for a new page. Will try the insert_post option and then filter the_content. Thanks! – Gustavo Benito Silva Jul 25 '15 at 15:43
  • how something appears depends on what theme someone is using, you don't have control over that. – Milo Jul 25 '15 at 15:44

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.