Answer the question
In order to leave comments, you need to log in
How to programmatically create a page in wordpress in a plugin?
How to programmatically create a page in wordpress in a plugin? Actually, this is not MVC, and even normal routing is not there. Now I'm not talking about the page in the admin panel, but on the site itself. I am working with WordPress for the first time, and I have not dealt with such ancient systems, but something needs to be done. Can anyone please describe how to do this?
Answer the question
In order to leave comments, you need to log in
// Создаем массив данных новой записи
$post_data = array(
'post_title' => wp_strip_all_tags( 'title' ),
'post_content' =>'post_content',
'post_name' => 'slug',
'post_status' => 'publish',
'post_author' => 1,
);
// Вставляем запись в базу данных
$post_id = wp_insert_post( $post_data );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question