Title: My code is not working in wordpress
Last modified: August 21, 2016

---

# My code is not working in wordpress

 *  [peacehunter](https://wordpress.org/support/users/peacehunter/)
 * (@peacehunter)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/)
 * I am trying to fetch some information from database in wordpress. I used jquery
   for sending ajax request and fetch the data from php file named values.php . 
   My php code is below
 * [http://pastebin.com/LFJmC9Fu](http://pastebin.com/LFJmC9Fu)
 * But after sending ajax request the php file sends me nothing. For testing I have
   added “echo ‘test’;” , but it does not display. When I remove or write the code“
   echo ‘test'” at top of this code “require_once($path.’/wp-config.php’);” then
   it works, I mean “echo ‘test’;” shows. That means the problem is in require_once.
 * I have tried many ways for solve this problem, but nothing works.
    Please give
   me suggestion what should I do now.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Hariprasad](https://wordpress.org/support/users/hariprasadprolanx/)
 * (@hariprasadprolanx)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898686)
 * Hi,
    Where you saved this php file? Can you show the javascript code?
 *  Thread Starter [peacehunter](https://wordpress.org/support/users/peacehunter/)
 * (@peacehunter)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898689)
 * I have saved the file in theme folder.
 * /themes/GeoTheme/values.php
 * my javascript code below,
 *     ```
       var value_tuh=document.getElementById("sr_tuh").value;
       jQuery("#content").load("<?php bloginfo('template_directory');?>/values.php",{s:value_tuh});
       ```
   
 * I am using child theme.
 *  [Hariprasad](https://wordpress.org/support/users/hariprasadprolanx/)
 * (@hariprasadprolanx)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898693)
 * You are sending value via variable ‘s’ and retrieving it using ‘q’.
    Check the
   code
 *     ```
       if($_GET['q']){
               autocompleter();
       }
       ```
   
 *  Thread Starter [peacehunter](https://wordpress.org/support/users/peacehunter/)
 * (@peacehunter)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898699)
 * I have fixed that, but still having same problem. 🙁
 *  [Hariprasad](https://wordpress.org/support/users/hariprasadprolanx/)
 * (@hariprasadprolanx)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898702)
 * Check this link
 * [http://wordpress.org/support/topic/using-wordpress-for-custom-database-queries?replies=9](http://wordpress.org/support/topic/using-wordpress-for-custom-database-queries?replies=9)
   
   It says
 * > You can include almost all of the wordpress code by simply adding this to the
   > top of any PHP file:
   >  require(‘./wp-blog-header.php’);
 * Try it
 *  Thread Starter [peacehunter](https://wordpress.org/support/users/peacehunter/)
 * (@peacehunter)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898709)
 * I have tried it. But its not working. After including this file, nothing happen.
   But if I write any code at the top of “require” then it works.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘My code is not working in wordpress’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 6 replies
 * 2 participants
 * Last reply from: [peacehunter](https://wordpress.org/support/users/peacehunter/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/my-code-is-not-working-in-wordpress/#post-3898709)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
