WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to access a DB table and render it in some data grid format using php on a dedicated wordpress page, accessible to members of a certain group. Is this at all possible with wordpress or is there another way to do so?

using wp 3.5 on linux system + mysql thanks

share|improve this question

migrated from webmasters.stackexchange.com Jan 8 '13 at 0:28

This question came from our site for pro webmasters.

This has already been answer on StackOverflow stackoverflow.com/questions/2810124/… – Steve Jan 8 '13 at 3:24

You can create a simple plugin and either add a shortcode to run your php, or filter the_content and add a conditional check for your specific page and inject your DB output. This way your code will be independent of the theme and more portable. Use the wpdb class to query any database /table.

share|improve this answer
+1 for shortcode. – webaware Jan 8 '13 at 7:38

What do you mean by "page" here?
You can throw whatever PHP you want into a page template. If this is a more or less one-off thing, what you should probably do is use the conditional tags to just embed it.

If you mean you want to do this within content arbitrarily ie. through the post editor, that's disallowed by core, but there are plugins that add the capability. The most recent one I'm aware of is Allow PHP in Posts and Pages, (there are others and you might want to look around) but this is something that's generally advised against unless you absolutely trust every single person that might have access.

share|improve this answer
Custom page templates are the way to go. – JCL1178 Jan 7 '13 at 23:47

There are plugins that allow you to run php code in the post content. Here are a couple:

http://wordpress.org/extend/plugins/php-code-for-posts/ http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.