Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress add new page programmatically

$new_page = array(
    'comment_status' => 'close',
    'ping_status' => 'close',
    'post_author' => $user_ID,
    'post_title' => ucwords('title_of_the_page'),
    'post_name' => strtolower(str_replace(' ', '-', trim('title_of_the_page'))),
    'post_status' => 'publish',
    'post_content' => 'Content of the page',
    'post_type' => 'page',
    'post_parent' => 'id_of_the_parent_page_if_it_available'
);
$post_id = wp_insert_post($new_page);
Comment

PREVIOUS NEXT
Code Example
Php :: int to char php 
Php :: php array to object 
Php :: php week of a date 
Php :: redirect from http to https laravel 
Php :: laravel call controller method from view 
Php :: laravel detach 
Php :: how to check user already exists in php 
Php :: increase php memory 
Php :: laravel json response 
Php :: php set title dynamically 
Php :: PHP filter_var() Function 
Php :: php mail 
Php :: how to combine variables and text into a string php 
Php :: laravel set a session variable 
Php :: form validation for file type in codeigniter 
Php :: laravel eloquent relationships count 
Php :: drupal 9 modify a views query 
Php :: replace all occurrence char in string php 
Php :: how to set time ago in php 
Php :: template literals php 
Php :: loop foreach laravel with number 
Php :: php return new object 
Php :: how to get display name in wordpress 
Php :: Remove last symbol from string 
Php :: php array subset by slicing 
Php :: request update password laravel 
Php :: update profile method in laravel 
Php :: php redirect with query string 
Php :: connect sql server php 
Php :: PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =