Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress get id from page title

//You can use OBJECT or null
/*
* RETURNS: the post array 
* post_name: is the name of the post you are looking for
* OBJECT: accepts results of WP_posts or get_posts  (i.e. $posts)
*         if you don't have and OBJECT just use null instead
* post_type: the name of your post type (i.e. 'page' or 'post'
* additional information https://developer.wordpress.org/reference/functions/get_page_by_title/
*
* ALSO get_page_by_path ('slug_name', OBJECT, 'post_type')
*/

$post = get_page_by_title( 'post_name' , OBJECT, 'post_type' );
echo $post->ID;
Comment

PREVIOUS NEXT
Code Example
Php :: array of dates laravel 
Php :: model with migration laravel 
Php :: how to display the site tagline in wordpress 
Php :: php recaptcha 
Php :: php geolocation package 
Php :: codeigniter form validation datetime 
Php :: php code for video upload 
Php :: if session is empty laravel 
Php :: symfony set timezone 
Php :: php location header 
Php :: php fetch mysql result as variable 
Php :: laravel migration alter column unique 
Php :: php example 
Php :: laravel route multiple methods 
Php :: php line break 
Php :: concatener 2 variables php 
Php :: php 8 match 
Php :: array key value php 
Php :: Laravel Eloquent Query Using WHERE with OR AND OR? 
Php :: how to fetch data from url in php properly 
Php :: wp_login_form wrong password redirect 
Php :: symnfony bearer token 
Php :: import local js file laravel 
Php :: php api method post 
Php :: eloquent get record older than 2 days 
Php :: laravel create model 
Php :: laravel check if email is verified 
Php :: phpmyadmin centos 8 
Php :: how to get previous date in laravel 
Php :: comment php 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =