Skip to content

Commit

Permalink
Merge pull request #47 from Abdukhaligov/master
Browse files Browse the repository at this point in the history
Add optional parameter for post (post_type)
  • Loading branch information
letrunghieu authored Dec 3, 2020
2 parents 6a4588f + 57768a8 commit 4eced38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/WordpressClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,16 @@ function getPosts(array $filters = array(), array $fields = array())
* @param array $categorieIds the list of category ids
* @param integer $thumbnailId the thumbnail id
* @param array $content the content array, see more at wordpress documentation
* @param string|null $type the type of post
*
* @return integer the new post id
*
* @link http://codex.wordpress.org/XML-RPC_WordPress_API/Posts#wp.newPost
*/
function newPost($title, $body, array $content = array())
function newPost($title, $body, array $content = array(), string $type = null)
{
$default = array(
'post_type' => 'post',
'post_type' => $type ?: 'post',
'post_status' => 'publish',
);
$content = array_merge($default, $content);
Expand Down

0 comments on commit 4eced38

Please sign in to comment.