| @@ 174-186 (lines=13) @@ | ||
| 171 | } |
|
| 172 | ||
| 173 | // Check if we have errors and return them or created message |
|
| 174 | if ( is_wp_error( $post_id ) ) { |
|
| 175 | error_log( $post_id->get_error_message() ); |
|
| 176 | return $post_id; |
|
| 177 | } else { |
|
| 178 | return array( |
|
| 179 | 'action' => 'created', |
|
| 180 | 'object' => 'post', |
|
| 181 | 'oid' => $post_id, |
|
| 182 | 'type' => get_post_type( $post_id ), |
|
| 183 | 'link_edit' => admin_url( '/post.php?post='.$post_id.'&action=edit' ), |
|
| 184 | 'link_view' => get_permalink( $post_id ), |
|
| 185 | ); |
|
| 186 | } |
|
| 187 | ||
| 188 | } |
|
| 189 | ||
| @@ 110-122 (lines=13) @@ | ||
| 107 | add_user_meta( $user_id, 'dummypress_test_data', '__test__', true ); |
|
| 108 | ||
| 109 | // Check if we have errors and return them or created message |
|
| 110 | if ( is_wp_error( $user_id ) ) { |
|
| 111 | error_log( $user_id->get_error_message() ); |
|
| 112 | return $user_id; |
|
| 113 | } else { |
|
| 114 | return array( |
|
| 115 | 'action' => 'created', |
|
| 116 | 'object' => 'user', |
|
| 117 | 'oid' => $user_id, |
|
| 118 | 'type' => $slug, |
|
| 119 | 'link_edit' => admin_url( '/user-edit.php?user_id=' . $user_id ), |
|
| 120 | 'link_view' => get_author_posts_url( $user_id ) |
|
| 121 | ); |
|
| 122 | } |
|
| 123 | ||
| 124 | } |
|
| 125 | ||