I have a page template in WordPress that calls an ajax function. That ajax calls an php function in another file, all declared like mentioned in ajax api in WordPress. Then I want to use in that php function a WordPress function, like get_template_dir_url()
and that call throw me an error that the function get_template_dir_url() is not declared
.
I had tried to load wp-load()
and other methods but they throws “already defined” errors. Your help with this would be very appreciated. Thanks in advance.
You can use the function
get_template_directory_uri()
, the problem is because you have a typo with the last character.