phpexec and wpdb problem (3 posts)

  1. brooklynwebguy
    Posted 11 years ago #

    Hi --

    I am having trouble using the wpdb object inside the <phpcode> tags of php exec. When I attempt to access wpdb with code that works when placed directly in a template, I get the following error when I put it in a post via phpexec:

    "Call to a member function on a non-object"

    Is there any way to fix this?

    It seems the combination of phpexec and the wpdb object are very powerful. I would be grateful for any help from an experienced hand.

  2. Kafkaesqui

    Posted 11 years ago #

    Try scoping $wpdb as global first in your <phpcode> call:

    global $wpdb;
    ~the rest of your code~

  3. brooklynwebguy
    Posted 11 years ago #

    That did it.


    That's quite a useful plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.