AnsPress_Admin::post_data_check( array $data )

Description #

[Not documented]

Parameters #

  • $data
    array (Required) Post data array.

Source #

File: admin/anspress-admin.php

	public static function post_data_check( $data ) {
		global $pagenow;

		if ( 'post.php' === $pagenow && 'answer' === $data['post_type'] ) {
			$parent_q = ap_sanitize_unslash( 'ap_q', 'p' );

			$parent_q = ! empty( $parent_q ) ? $parent_q : $data['post_parent'];

			if ( empty( $parent_q ) ) {
				add_filter(
					'redirect_post_location',
					array( __CLASS__, 'custom_post_location' ),
					99
				);
				return;
			}
		}

		return $data;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment