Please write function for get post by title
function get_page_by_post_title( $page_title, $output = OBJECT, $post_type="page" ) {
global $wpdb;
$sql = $wpdb->prepare(
"
SELECT ID
FROM $wpdb->posts
WHERE post_title = %s
AND post_type = %s
ORDER BY ID DESC
",
$page_title,
$post_type
);
$page = $wpdb->get_var( $sql );
if ( $page ) {
return get_post( $page, $output );
}
}
And this is your inquire_id function like,
function get_inquiry_id($data){
$return = [];
$title=$data['title'];
$return = get_page_by_post_title($title, OBJECT, 'inquiry');
$return = $return->ID;
return new WP_REST_Response($return, 200);
}
Related Posts:
- How do I access the body of a WP API request in a custom route?
- wp rest api v2 return json_no_route
- WP-REST API not returning all its endpoints, 404 on documented endpoints
- WP REST API V2 – Modifying responses
- OAuth signature does not match
- How to upload image to wordpress from external page
- WP API to fetch all records for /posts, /media, /categories
- WP Rest API get page from path
- backbone fetch() not working
- WP-API user email change confirmation
- No featured media in API request
- Syntax for REST API to have bold formatted and multiple lines in product description [closed]
- WP Rest get all by post within that category, by category name not by cat ID
- Add Data to Response of WP-JSON Root
- OAuth1 empty “authentication” in /wp-json
- WP – API – OAuth 1.0a Server, How to implement with AngularJS?
- Are there events pub/sub for external application to subscribe to file/pdf uploads by wordpress admin
- WP API and Proxy
- Get single item from cURL plugin API call inside bash [closed]
- why woocommerce api only do not upload images from local computer? [closed]
- ng-repeat is not returning a list of posts
- What request is WordPress sending on theme update?
- Is WP API going to be around in the long term?
- How to Create a Post from localfiles?
- Get a complete list of all categories using node-wpapi
- upload image to wp-api
- WP-API call function
- Update Custom Post Type Metadata Wp Rest API
- WP-API Content showing null
- How to retreive/set wordpress page html?
- How can I use React packages with the clasic editor?
- Get post count in wp rest API v2 and get all categories
- Query WP REST API v2 by multiple meta keys
- How do I cache (core) API requests?
- WP REST API only returning partial list of users
- Is there a way to get protected meta fields through any of the available built-in WordPress APIs? (xmlrpc, wp-json)
- Fetching private posts or custom post types via WP-API with basic authentication
- How to update/insert custom field(post meta) data with wordpress REST API?
- How to save new transients if query changes?
- Unset data in custom post type WordPress API (wp-json)
- How do I retrieve a list of popular plugins using the WordPress.org Plugin API?
- WP API : date_query parameter
- Get the Category Name instead of ID from WP-API
- WP API to fetch all the media/posts records if count is more than 100
- Add Products to Woocommerce through WP API
- WP REST API – Retrieve content from page
- Updata Metadata WP Rest API
- Authentication for a mobile app connected via wp-rest api?
- WP Rest API max limit include parameter?
- Passing Meta array in wp-rest api
- How to make a WP REST API query with meta_query in WP4.7?
- Hook before posting via JSON REST API
- Display post title from WordPress excluding a string via API
- WP_REMOTE_POST Requests are being blocked by API provider [closed]
- Cache WP remote_get HTTP Response using Transients
- I am getting error message on accessing menu-endpoint
- Update Line Item Meta Data – WooCommerce API
- Woocommerce api: create product with images – bad request
- Posting page on all subdomains
- WP-API select custom taxonomy when creating a post
- Using WordPress as an API [closed]
- How to edit feature image with XML RPC?
- Get a remote post ID via API given URL
- Core function to check if a rest namespace exists
- Getting featured image with PHP and not javascript from wordpress api _embed [closed]
- How to change the date and time in REST API for comments?
- Is there a way to download only the Rest API part of WordPress?
- Custom Endpoint API based on attribute gutenberg block
- How to see posts in taxonomy endpoint
- Uploading a media item with the wp-json API to a specific path
- post values to custom post type which has advanced custom fields
- Custom REST endpoint not working to retrieve single posts (“rest_no_route”)
- How to add a rest field to post tags?
- Why is wp api returning old acf values?
- Why are tags from the header showing up on my WordPress site? [closed]
- WP-API: get posts in multiple categories
- oAuth2 Authentication in WordPress using WP OAuth Server and WP API plugins
- WP-API Custom Post Type json_no_route
- Refresh individual comment text via API
- How to display relations via wordpress Rest API
- How can I create new CustomPostType record using wp.api.collections?
- wp-api Backbone JS Client fetch options
- do_action in API call
- wp_update_user very slow
- register/login api
- How do i post data to url with fields?
- How to use following API with WordPress?
- Help to create the best plugin settings!
- wp_insert_user if user exists
- WooCommerce API Returns 401
- Consume legacy rest api dependent upon WP API plugin
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- How to get custom or filtered endpoints in WordPress API?
- WP API users per page
- Combining results from WP-API using AngularJS
- Remove a field from json in wp rest api v1
- WP REST API v2. filters doesn’t work
- WP REST API Access-Control-Allow-Origin response is cached
- How to update WordPress Plugins in your own maintance application?
- XMLRPC: How to retrieve possible custom fields for a new post?