Title: Fatal error: Call to undefined function wp_json_encode() in
Last modified: August 22, 2016

---

# Fatal error: Call to undefined function wp_json_encode() in

 *  [philvelez](https://wordpress.org/support/users/philvelez/)
 * (@philvelez)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-wp_json_encode-in/)
 * Hello. I have read several mentions of this error but most of the ways to resolve
   the issue include removing or changing some code. I am not a programmer and only
   have limited knowledge of HTML so how can I resolve this issue?
 * The full error reads –
    Fatal error: Call to undefined function wp_json_encode()
   in /homepages/38/d104341871/htdocs/clickandbuilds/MitiMitiTaperia/wp-admin/includes/
   misc.php on line 668
 * I cannot access the dashboard or edit any pages and cannot even see the page 
   with code to remove/edit line 668. Any advice would be greatly appreciated.
 * Thanks in advance.

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

 *  [C W (VYSO)](https://wordpress.org/support/users/cyril-washbrook/)
 * (@cyril-washbrook)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-wp_json_encode-in/#post-5716389)
 * This is a problem that quite a few people have experienced. You can start by 
   trying to reinstall WordPress manually. [Download the latest version of WordPress](https://wordpress.org/download/)
   and carefully follow the steps on [this page](http://codex.wordpress.org/Updating_WordPress#Manual_Update).
 *  [travinum1](https://wordpress.org/support/users/travinum1/)
 * (@travinum1)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-wp_json_encode-in/#post-5716409)
 * If that’s the only method you are missing, here is the source code.
    Maybe just
   add it to the file?
 *     ```
       function wp_json_encode( $data, $options = 0, $depth = 512 ) {
           /*
            * json_encode() has had extra params added over the years.
            * $options was added in 5.3, and $depth in 5.5.
            * We need to make sure we call it with the correct arguments.
            */
           if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
               $args = array( $data, $options, $depth );
           } elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
               $args = array( $data, $options );
           } else {
               $args = array( $data );
           }
   
           $json = call_user_func_array( 'json_encode', $args );
   
           // If json_encode() was successful, no need to do more sanity checking.
           // ... unless we're in an old version of PHP, and json_encode() returned
           // a string containing 'null'. Then we need to do more sanity checking.
           if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) )  {
               return $json;
           }
   
           try {
               $args[0] = _wp_json_sanity_check( $data, $depth );
           } catch ( Exception $e ) {
               return false;
           }
   
           return call_user_func_array( 'json_encode', $args );
       }
       ```
   
 *  [Golden Lion Solutions](https://wordpress.org/support/users/golden-lion-solutions/)
 * (@golden-lion-solutions)
 * [11 years ago](https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-wp_json_encode-in/#post-5716714)
 * travinum1 – thank you so much!!!! you saved my website!!! after weeks of searching
   and trying different things, my site is finally fixed thanks to you!!
 * thanks a lot!

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

The topic ‘Fatal error: Call to undefined function wp_json_encode() in’ is closed
to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 4 participants
 * Last reply from: [Golden Lion Solutions](https://wordpress.org/support/users/golden-lion-solutions/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-wp_json_encode-in/#post-5716714)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
