Titan-Framework icon indicating copy to clipboard operation
Titan-Framework copied to clipboard

Suggestion for the documentation: Hooks and Filters

Open ardalann opened this issue 11 years ago • 6 comments

In my settings, there's a checkbox that registers a new post type when it's checked. This custom post type was supposed to have a rewritten URL, but it didn't work. Until I found this in WordPress Codex ( http://codex.wordpress.org/Function_Reference/register_post_type ):

Note: If registering a post type inside of a plugin, call flush_rewrite_rules() in your 
activation and deactivation hook (see Flushing Rewrite on Activation below). 
If flush_rewrite_rules() is not used, then you will have to manually go to 
Settings > Permalinks and refresh your permalink structure before your custom 
post type will show the correct structure. 

So I looked for a hook that is called right after saving data, and I found 'tf_admin_options_saved_{namespace}' I added this line of code:

add_action('tf_admin_options_saved_mythemename', 'flush_rewrite_rules');

Aaaand it's fixed! The hook was really helpful. I was thinking, maybe other developers face the same issue, and having this somewhere inside the documentation could help them out. Maybe we should have a documentation section for hooks and filters.

ardalann avatar Mar 13 '14 21:03 ardalann

Yea we need docs to list all the hooks and how to use them.

Might be a good idea to add more hooks which might be helpful

bfintal avatar Mar 13 '14 23:03 bfintal

Just waiting for the titanframework.net site to stabilize, then I'll proceed to get this done pronto.

oherman avatar Aug 03 '14 15:08 oherman

All right, created the category for hooks. the documentation site www.titanframework.net will be further updated.

oherman avatar Aug 12 '14 10:08 oherman

Just started working with Titan. Nice stuff! But I found documentation lacking as well, especially around hooks. I am happy to contribute as I work with it. Let me know if that is possible and how to get involved!

MartyThornley avatar Dec 24 '14 19:12 MartyThornley

FWIW, if you follow the WP core inline documentation standards for PHP, you can use the official phpdoc-parser plugin to parse your hook docs into a WordPress site.

DrewAPicture avatar Jun 23 '17 01:06 DrewAPicture

Welp, I'm not sure how I unassigned @oherman since I'm not a collaborator here ... but, whoops!

DrewAPicture avatar Jun 23 '17 01:06 DrewAPicture