Posts'; foreach ( $posts as $post ) { if ( ! is_object( $post ) ) { echo "$post\n"; } else { echo "

$post->ID: $post->post_title
"; echo "$post->post_type – $post->post_status – $post->relevance_score
"; property_exists( $post, 'relevanssi_link' ) && print( "relevanssi_link: $post->relevanssi_link
" ); echo 'the_permalink(): '; the_permalink( $post->ID ); echo '
get_permalink(): ' . get_permalink( $post ); echo '

'; } } // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Prints out an array in a preformatted block. * * @param array $array_value The array to print. * @param string $title The title for the array. */ function relevanssi_debug_array( $array_value, $title ) { echo '

' . esc_html( $title ) . '

'; echo '
';
	print_r( $array_value ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
	echo '
'; } /** * Prints out a string in a preformatted block. * * @param string $str The string to print. * @param string $title The title for the string. */ function relevanssi_debug_string( $str, $title ) { echo '

' . esc_html( $title ) . '

'; echo '
' . esc_html( $str ) . '
'; } /** * Prints out the Relevanssi debug information for a post. * * This function is called by the 'wp' action, so it's executed on every page * load. */ function relevanssi_debug_post() { if ( ! is_singular() || ! relevanssi_is_debug() ) { return; } global $post; echo '

' . esc_html( $post->post_title ) . ' (' . intval( $post->ID ) . ')

'; echo '

Index

'; echo relevanssi_generate_how_relevanssi_sees( $post->ID, true, 'post' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo '

Database

'; echo '
' . relevanssi_generate_db_post_view( $post->ID ) . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped relevanssi_debug_array( get_post_meta( $post->ID ), 'Post meta' ); exit(); } /** * Generates the debugging view for a post. * * @param int $post_id ID of the post. * * @return string The debugging view in a div container. */ function relevanssi_generate_db_post_view( int $post_id ) { global $wpdb; $element = '
'; $post_object = get_post( $post_id ); if ( ! $post_object ) { $element .= '

' . esc_html__( 'Post not found', 'relevanssi' ) . '

'; $element .= '
'; return $element; } $element .= '

' . esc_html( $post_object->post_content ) . '

'; $element .= ''; return $element; } /** * Prints out the Relevanssi debug information for search settings. */ function relevanssi_debug_search_settings() { // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped echo '

Relevanssi searching settings

'; echo '

'; $value = get_option( 'relevanssi_fuzzy' ); echo "relevanssi_fuzzy: $value
"; $value = get_option( 'relevanssi_implicit_operator' ); echo "relevanssi_implicit_operator: $value
"; $value = get_option( 'relevanssi_disable_or_fallback' ); echo "relevanssi_disable_or_fallback: $value
"; $value = get_option( 'relevanssi_throttle' ); echo "relevanssi_throttle: $value
"; $value = get_option( 'relevanssi_throttle_limit' ); echo "relevanssi_throttle_limit: $value
"; $value = get_option( 'relevanssi_default_orderby' ); echo "relevanssi_default_orderby: $value
"; echo '

'; // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Returns true if RELEVANSSI_DEBUG, WP_DEBUG and WP_DEBUG_DISPLAY are true. * * @return bool True if debug mode is on. */ function relevanssi_log_debug(): bool { return defined( 'RELEVANSSI_DEBUG' ) && RELEVANSSI_DEBUG && defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY; }