Skip to content

Commit 4eced38

Browse files
authored
Merge pull request #47 from Abdukhaligov/master
Add optional parameter for post (post_type)
2 parents 6a4588f + 57768a8 commit 4eced38

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/WordpressClient.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,16 @@ function getPosts(array $filters = array(), array $fields = array())
282282
* @param array $categorieIds the list of category ids
283283
* @param integer $thumbnailId the thumbnail id
284284
* @param array $content the content array, see more at wordpress documentation
285+
* @param string|null $type the type of post
285286
*
286287
* @return integer the new post id
287288
*
288289
* @link http://codex.wordpress.org/XML-RPC_WordPress_API/Posts#wp.newPost
289290
*/
290-
function newPost($title, $body, array $content = array())
291+
function newPost($title, $body, array $content = array(), string $type = null)
291292
{
292293
$default = array(
293-
'post_type' => 'post',
294+
'post_type' => $type ?: 'post',
294295
'post_status' => 'publish',
295296
);
296297
$content = array_merge($default, $content);

0 commit comments

Comments
 (0)