Issue when trying to add a new listing with the rich text enabled description

There is a snippet on this site and github, that turns on the rich text editor for description:

add_filter(
	'hivepress/v1/models/listing',
	function( $model ) {
		$model['fields']['description']['editor'] = true;

		return $model;
	},
  1000
);

When enabled and trying to add a listing, typing anything in the description filed is ignored upon submit. It says “Description is required” although it’s not empty.

If you edit already existing listing - it posts the description content without problems.

When the second part of the snippet is activated making description “optional”, than adding new listing is almost always comes with loosing anything you copied or typed into description field. Have to edit the listing in order to save the content inside the description field.

Steps to reproduce

Try adding a new listing. Type or copy something in the description field (rich text enabled). Submit. You will see either a warning that description is required or it will save with an empty description if description field is optional.

If edited - anything from the description box is saved and shown in a listing.

I have a combined snippet for the description field:

add_filter(
	'hivepress/v1/models/listing/fields',
	function( $fields ) {
		$fields['description']['editor'] = true;
		$fields['description']['required'] = false;
		return $fields;
	},
	1000,
	1
);

Expected result

I expect description field with rich text enabled to add and save the content from the first try on a new listing, not coming back editing it to add the description content.

Extra details

dragstrip.ru

I saw this code snippet too, and thought : great !

But experience showed me it’s quite buggy. I gave up using it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.