Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow registering custom categories through filter #509

Merged
merged 11 commits into from
Jul 9, 2024

Conversation

ernilambar
Copy link
Member

@ernilambar ernilambar commented Jul 8, 2024

Fixes #494

  • Introduce filter wp_plugin_check_categories
  • Add new method get_check_categories() in Check_Categories class
  • Add test for related changes

Example implementation: https://github.com/ernilambar/fresh-check/blob/main/fresh-check.php

@ernilambar ernilambar marked this pull request as ready for review July 8, 2024 07:34
Copy link

github-actions bot commented Jul 8, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ernilambar <rabmalin@git.wordpress.org>
Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: davidperezgar <davidperez@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

ernilambar and others added 2 commits July 8, 2024 15:01
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
@ernilambar
Copy link
Member Author

Looks like we have used key/value pair, like:

$category_labels  = $check_categories->get_category_labels();

$categories = array();

foreach ( $category_labels as $slug => $label ) {
	$categories[] = array(
		'slug' => $slug,
		'name' => $label,
	);
}

So I think we need to adjust in other places also.

@swissspidy
Copy link
Member

Then these places should call get_categories()

As `test_get_category_labels` check same function `get_categories()` let's remove it.
@mukeshpanchal27
Copy link
Member

mukeshpanchal27 commented Jul 9, 2024

In 37aeb20, I have removed the test_get_category_labels test as they test the same get_categories() data values, making them redundant.

@ernilambar
Copy link
Member Author

May be we could remove that labels function. It is not used anywhere I guess.

@mukeshpanchal27
Copy link
Member

Yes but that function introduce in 1.0, leave it for now.

@mukeshpanchal27 mukeshpanchal27 merged commit e9fe870 into WordPress:trunk Jul 9, 2024
22 checks passed
@ernilambar ernilambar deleted the 494-customize-categories branch July 9, 2024 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants