AnsPress_Hooks::wp_insert_post_data( array $data, array $args )
Description #
Filter post so that anonymous author should not be replaced by current user approving post.
Parameters #
- $dataarray (Required) post data.
- $argsarray (Required) Post arguments.
Changelog #
Source #
File: includes/hooks.php
public static function wp_insert_post_data( $data, $args ) { global $post; if ( in_array( $args['post_type'], [ 'question', 'answer' ], true ) ) { $fields = ap_get_post_field( 'fields', $args['ID'] ); if ( ( is_object( $post ) && '0' === $post->post_author ) || ( !empty( $fields ) && !empty( $fields['anonymous_name'] ) ) ) { $data['post_author'] = '0'; } } return $data; }
Expand full source code Collapse full source code View on GitHub: includes/hooks.php:578
Add your comment