0

i am trying to create a custom wordpress page so that i can load data from ajax call and can use wordpress functions in that file . the problem is even after including all the right file required for custom wordpress php file its giving me error of

Fatal error: Call to undefined function wp_get_current_user() in /web/sites/meta/mormonrod.com/wp-includes/capabilities.php on line 1281

I followed the steps in this question too (Using WPDB in standalone script?) which included these files

$path = $_SERVER['DOCUMENT_ROOT'];

include_once $path . '/wp-config.php';
include_once $path . '/wp-load.php';
include_once $path . '/wp-includes/wp-db.php';
include_once $path . '/wp-includes/pluggable.php';

but still i have that error showing up and which does not lets the ajax call to be completed .

Community
  • 1
  • 1

1 Answers1

0

You can do it using create one file in your folder and in this file at the top write this line

/*Template Name: xyz */

Now create one page from admin and select template as xyz and now in this file you can write your custom code as well you use wordpress function without including any file.

or you can refer below link for ajax call in wordpress
http://www.1stwebdesigner.com/css/implement-ajax-wordpress-themes/

Praveen kalal
  • 2,148
  • 4
  • 19
  • 33
  • can i use this file for ajax calls? like i load data from this file to another file ? – john player Mar 12 '13 at 04:52
  • then let me try it once as i never thought or read this solution here in stack before i posted my problem for help – john player Mar 12 '13 at 04:55
  • have you followed this link http://www.1stwebdesigner.com/css/implement-ajax-wordpress-themes/ – Praveen kalal Mar 12 '13 at 05:05
  • yes but thats a different thing. i am trying to make a custom pagination system via new jquery 1.9 anf for that i need to load data from other file which uses wordpress functions and i dont know why its getting so hard to do it . i have followed the right steps too – john player Mar 12 '13 at 05:09