I want to change the behavior when deleting location rules and categories in the Advanced Custom Fields plug-in.

Asked 1 years ago, Updated 1 years ago, 68 views

WordPress uses the Advanced Custom Fields (ACF) plug-in.


Location rules. タクPost Taxonomy 【 】Equivalent 【 カテCategory A 】
I set it to , but there was a change in the category after that.
When you delete Category A, the location rule is
タクPost Taxonomy 【 】Equivalent 【 未Unclassified <
Failed to rewrite to

When you delete a category, if the location rule contains the deleted category,
I want the rule itself to be deleted automatically, but
How can it be realized?

I would appreciate it if you could let me know.

wordpress

2022-09-30 19:45

1 Answers

It's not a direct attack, but when you delete a category, you can use the hook delete_term_taxonomy to find the slag of the category to be deleted from the ACF configuration data, and if it hits, you can overwrite the ACF configuration value.

ACF configuration is saved as a post in wp_posts and rules are saved in post_content.
If you overwrite this with wp_update_post(), the rule disappears unless you press Update on the ACF Administration screen.


2022-09-30 19:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.