wordpressのコア機能を使用してページを追加するにはどうすればよいですか。投稿などの機能も見つけることができますが、ページの機能は見つかりませんでした。助けてくれる人ありがとう
1 に答える
2
同じ関数を使用して投稿またはページを追加します。次のpost_type
ようなパラメーターを追加するだけです。
$args = array( 'post_type' => 'page',
'post_content' => 'You content...',
'post_parent' => $parent_id; // ID of the page this one should be a child of
... // etc.
...
'post_title' => 'Title for your page');
wp_insert_post ($args);
于 2013-01-08T22:46:53.080 に答える