rss
0

Lessons Learned: WordPress

  • Sumo

I just want to point out some new things I have learned from the recent WordPress theme and plugin development.

1. Custom Taxonomy.

As you know register_taxonomy(…) -is used to register a new taxonomy, be it a hierarchical like categories or flat list like tags.

Remember to give a lowercase taxonomy name as the first argument to this function, because otherwise “Choose from the most used {new_taxonomy}” will not work in admin panel.

So instead of writing

register_taxonomy(
"MultiPartVideo"
, array("post")
, array("hierarchical" => false,
"labels" => $mv_labels,
'rewrite' => false
)

Write taxonomy name lowercase

register_taxonomy(
"multipartvideo"
, array("post")
, array("hierarchical" => false,
"labels" => $mv_labels,
'rewrite' => false
)

 

2. Custom Post Types are not working!! Help!

Remember that after adding a new custom post type (with register_post_type() function), you should manually change website permalink structure to something else, and then change it back.

Additionally you can run this code in functions.php only for one time, after adding new post types

$wp_rewrite->flush_rules();

About the Author

Edgar Marukyan is an expert of website development and performance optimization, who maintains and consults clients with high load traffic websites.. If you need an assistance, feel free to drop me a line.         Website - Twitter - Facebook

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.