How to find out which function is causing a 404

Go to http://[your-site].com/wp-admin and have a look in the Posts or Pages menu (or if it’s a custom post type, the edit screens for your post type). Also, if it’s indeed there, check your permalinks (Settings > Permalinks) and save them even if you don’t make any changes. This will flush the permalinks, which might …

Read more

Debug errors on sidebar

You should check that the variable exists before using it. isset() will return true if a variable has been set and is not null. For example: update_post_meta($post->ID, “_sidebar”, $_POST[“link”]); will become: if ( isset( $_POST[“link”] ) ) { update_post_meta( $post->ID, “_sidebar”, $_POST[“link”] ); } As an aside, it’s a good idea to validate your data …

Read more

Debugging – trying to add search box to menus

wp_nav_menu_items aren’t mentioned in the codex, so there are no concrete description on how to use it. wp_nav_menu_items can be found on line 347 in wp-includes/nav-menu-template.php $items = apply_filters( ‘wp_nav_menu_items’, $items, $args ); within wp_nav_menu. In the codex, it states the following Displays a navigation menu created in the Appearance → Menus panel. So this …

Read more

Debugging WordPress

The basic technique of logging queries is that if SAVEQUERIES constant is defined to be true (it’s not by default for performance reasons) then $wpdb->queries will keep the log of queries performed. There isn’t anything on top of this that WordPress natively does. There are plenty of plugins around which work either by interpreting this …

Read more

Where are WP_Errors Saved

WP_Error kind of errors are a poor substitution for exception (something that php 4 didn’t have IIRC), they are not actual software errors, and are not being kept in any log if the developer do not write code for it.