php - Custom WordPress API Route Returning 500 Error -


the story created custom api route /wp-post-modal/v1/any-post-type pulls posts of post type. locally works (mamp), on multiple production servers (different environments) returns 500 error.

api route works on local:

api route examples on production (show api route exist):

usage should work on production (but don't because of 500 error):

i checked nginx error logs on server , empty.

code custom api route:

/**  * register api route: query post type  */ public function any_post_api_route() {      register_rest_route( $this->plugin_name . '/v1', '/any-post-type/', array(         'methods'  => 'get',         'callback' => array( $this, 'get_content_by_slug' ),         'args'     => array(             'slug' => array(                 'required' => false             )         )     ) );  }  /**  *  * content slug  *  * @param wp_rest_request $request  *  * @return wp_rest_response  */ public function get_content_by_slug( wp_rest_request $request ) {     wpbmap::addallmappedshortcodes();      // slug request     $slug = $request['slug'];      // title slug     $return = get_page_by_path( $slug, array_a, array( 'page', 'post' ) );      // render shortcodes visual composer     $return['post_content'] = apply_filters( 'the_content', $return['post_content'] );      $response = new wp_rest_response( $return );      return $response;  } 

try updating first line in get_content_by_slug() this:

if ( class_exists( 'wpbmap' ) ) { wpbmap::addallmappedshortcodes(); }

my guess have wpbmap library or plugin locally, it's not available in production sites.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -