Title: WordPress oop plugin developing, Call function error!
Last modified: October 17, 2018

---

# WordPress oop plugin developing, Call function error!

 *  Resolved [bearshang](https://wordpress.org/support/users/bearshang/)
 * (@bearshang)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/wordpress-oop-plugin-developing-call-function-error/)
 * My plugin based on OOP.
    So when i call a function, It gives Error.
 * Example:
 *     ```
       <?php
       namespace Trueniu\Cloudfront;
       class Invalidate
       {
           public function example(){
               $response = wp_remote_post([...]);
           }
       }
       ```
   
 * Error msaage:
 *     ```
       Error: Call to undefined function Trueniu\Cloudfront\wp_remote_post()
       ```
   
 * How to fix it.
    -  This topic was modified 7 years, 7 months ago by [bearshang](https://wordpress.org/support/users/bearshang/).

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

 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/wordpress-oop-plugin-developing-call-function-error/#post-10789418)
 * Since the WordPress core functions are in a different namespace, you must call
   the function with its namespace, as follows:
 *     ```
        $response = \wp_remote_post([...]);
       ```
   
 * For reference: [https://secure.php.net/manual/en/language.namespaces.php](https://secure.php.net/manual/en/language.namespaces.php)
 *  Thread Starter [bearshang](https://wordpress.org/support/users/bearshang/)
 * (@bearshang)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/wordpress-oop-plugin-developing-call-function-error/#post-10789457)
 * [@diondesigns](https://wordpress.org/support/users/diondesigns/)
    You are right.
   Thanks.

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

The topic ‘WordPress oop plugin developing, Call function error!’ is closed to new
replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [bearshang](https://wordpress.org/support/users/bearshang/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/wordpress-oop-plugin-developing-call-function-error/#post-10789457)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
