Adding Wordpress Categories Based On Post Content

前端 未结 1 1005
野的像风
野的像风 2021-01-28 10:42

I am working on a Wordpress site that users can login to and make posts. I want to add some functionality to their posts. Basically, I want to provide the ability for the user t

相关标签:
1条回答
  • 2021-01-28 11:28

    You're on the right track.

    Take a look at WordPress Hooks. You're interested in the edit_post hook.

    Within a custom callback you can parse the content and look for your category hashes. Then use native WordPress functions to query an existing category or create a new one. Most of the complex logic will be in the latter part. The rest should be string manipulation.

    This doesn't necessarily have to be a plugin. This could live in your functions.php file of your theme.

    Remember, the codex is your friend.

    0 讨论(0)
提交回复
热议问题