Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BUG: ep_exclude_from_search is not saved on custom post types. #4034

Closed
1 task done
maartenhunink opened this issue Dec 10, 2024 · 3 comments · Fixed by #4040
Closed
1 task done

BUG: ep_exclude_from_search is not saved on custom post types. #4034

maartenhunink opened this issue Dec 10, 2024 · 3 comments · Fixed by #4040
Labels
bug Something isn't working

Comments

@maartenhunink
Copy link

Describe the bug

The Exclude from search results checkbox unchecks itself automatically when you save a custom post type. This does work as intended on normal post types, but not on custom ones.

Tested on a fresh install without any other plugins.

Steps to Reproduce

  1. Add a custom post type to your theme/project
  2. Go to create/edit a post
  3. Check the 'Exclude from search results
  4. Click Publish/Save

Screenshots, screen recording, code snippet

Screen.Recording.2024-12-10.at.22.47.05.mov

Environment information

No response

WordPress and ElasticPress information

Latest wordpress and eliasticpress

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maartenhunink maartenhunink added the bug Something isn't working label Dec 10, 2024
@felipeelia
Copy link
Member

@maartenhunink can you please check if the value sticks if you add support to 'custom-fields' to your CPT? Like this, for example:

	register_post_type(
		'movie',
		[
			'labels'       => [
				'name'          => __( 'Movies' ),
				'singular_name' => __( 'Movie' ),
			],
			'public'       => true,
			'has_archive'  => true,
			'taxonomies'   => [ 'category' ],
			'show_in_rest' => true,
			'supports' => [ 'title', 'editor', 'custom-fields' ], <-- This line here
		]
	);

@maartenhunink
Copy link
Author

Ah, that fixes it indeed! Thanks a lot for looking into it so quickly and providing the solution.

It might be helpful to add this to the documentation somewhere?

Thanks!

@felipeelia
Copy link
Member

Sure thing, @maartenhunink. After the release I'll add it to our documentation, thanks

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
2 participants