weDevsOfficial/wp-user-frontend

[BUG] Selected category option is not visible on frontend post

Closed this issue · 2 comments

Description: Selecting a category option while filling up a form is working fine. But the selected option is not reflecting on the published post from frontend

Steps:

  1. Create a post from including category option selection field
  2. Publish the form and create a post from frontend
  3. Publish the post and observe that the selected category option is not reflecting on the post

More details and reference video in slack Thread

categories and meta fields are not the same. so we can’t treat them the same way. there should be some theme options to show the categories. if the user needs to show them in the content body, here is a basic way:

add_filter( 'the_content', 'astra_show_categories' );
function astra_show_categories( $content ) {
	if ( ! is_single() ) {
		return $content;
	}

	$categories_list = get_the_category_list( esc_html__( ', ', 'theme-text-domain' ) );

	if ( $categories_list ) {
		$content .= 'Categories: ' . $categories_list;
	}

	return $content;
}

Not an issue. Fixed in client site.