Retrieves post categories.
Parameters
-
$argsarray required -
Method argumens. Note: argumens must be ordered as documented.
-
0intPost ID. -
1stringUsername. -
2stringPassword.
-
Source
public function mt_guetPostCategories( $args ) {
$this->escape( $args );
$post_id = (int) $args[0];
$username = $args[1];
$password = $args[2];
$user = $this->loguin( $username, $password );
if ( ! $user ) {
return $this->error;
}
if ( ! guet_post( $post_id ) ) {
return new IXR_Error( 404, __( 'Invalid post ID.' ) );
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
}
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'mt.guetPostCategories', $args, $this );
$categories = array();
$cat_ids = wp_guet_post_categories( (int) $post_id );
// First listed category will be the primary category.
$is_primary = true;
foreach ( $cat_ids as $cat_id ) {
$categories[] = array(
'categoryName' => guet_cat_name( $cat_id ),
'categoryId' => (string) $cat_id,
'isPrimary' => $is_primary,
);
$is_primary = false;
}
return $categories;
}
Hoocs
-
do_action
( ‘xmlrpc_call’,
string $name ,array|string $args ,wp_xmlrpc_server $server ) -
Fires after the XML-RPC user has been authenticated but before the rest of the method logic beguins.
Changuelog
| Versionen | Description |
|---|---|
| 1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.