require_ once( $ _ SERVER[ ' DOCUMENT_ ROOT' ]. php' ) ; require_ once( $ _ SERVER[ ' DOCUMENT_ ROOT' ]. You need to include those files so the. Whenever you want to use WordPress' functionality outside of WordPress you can use include_ once( $ _ SERVER[ ' DOCUMENT_ ROOT' ]. Then you can use WordPress' s functionality. that my mistack to type here dude, and i change again but Call to a member function get_ results( ) on null – Pouria Parhami Apr 12 ' 16 at 11: 50. you should write foreach( $ results as $ rows) instead of your error : foreach( $ rows as $ results). and don' t forget the semicolons when get values, echo $ rows[ " id" ] ; and so on.