Metabox doesn’t retain values

Many of the comments below refer to code used for debugging, which for clarity I’ve removed. I should have spotted this soon – you are adding only one row into the postmeta table, and that row has the key _my_meta. Before inserting the array int the table, WordPress serializes the array. When you retrieve the … Read more

Why do I have “category” in my permalinks?

By setting your permalinks to %category%/%postname%, you are setting the permalinks only for your posts and pages. Below the posts and pages permalinks option is another one for your categories. Just set your categories slug to . and it will just be the category name. Here’s a visual example:

Adding an additional menu in WordPress

b-grader First, you should you this format to add menu location (in your function.php) add_action(‘init’, ‘register_top_menu’); function register_top_menu() { register_nav_menu(‘top_menu’, __(‘Top Menu’, ‘your_text_domain’)); register_nav_menu(‘bottom_menu’, __(‘Bottom Menu’, ‘your_text_domain’)); } (note: ‘your_text_domain’ is used for translation..) Then in the place you want the menu to apear.. <?php wp_nav_menu( array( ‘theme_location’ => ‘primary-menu’ ) ); ?> so… if … Read more

Custom table or form

How I would do it: Create a public accessible form in a page. Look at the code of front end submission plugins to get an idea. Create a custom post type shipping. Create a custom user role customer with very limited capabilities (read_shipping, edit_user_profile). After form submission create a new shipping entry, register the user … Read more

Use Loop or direct database query?

In general I try to avoid custom SQL queries as much as i can and use the native WordPress functions but in some cases its much better/faster to use custom queries. if the case is just get a list of posts the you can use the WP_Query or get_posts which will work almost as fast … Read more