Tag Info

Hot answers tagged

2

This error: Fatal error: Call to a member function insert() on a non-object Means that $wpdb isn't instantiated so you are running your code too early or out of WordPress context-- for example, in an exterior PHP file accessed directly, which is what I suspect (Poorly conceived AJAX request perhaps?). As mentioned, the code has more formats that data ...


1

EDIT: If you use $post in a function, you have to define it of course: function xyz(){ global $post; //Your code } Initial answer, might help others: It appears to me, you do not use it inside an action or if so, you use it to early. It should work inside the 'init' action. So you could do something like <?php add_action( 'init', ...



Only top voted, non community-wiki answers of a minimum length are eligible