WordPress Specified file failed upload test

You need to add the mime type to the whitelist of allowed file types. Assuming this one still works, you can go the plugin route using. http://wordpress.org/extend/plugins/pjw-mime-config/ Alternatively if you want to add your own mimes in code form, here’s an example. add_filter( ‘upload_mimes’, ‘your_custom_mimes’ ); function your_custom_mimes( $mimes ) { $mimes[‘extensionhere’] = ‘mimetype/goes-here’; return … Read more

My custom plugin did not create db tables in database

Late response, but this might help others to understand why $wpdb->prepare should not be used with SQL CREATE statements. The answer is that $wpdb->prepare surrounds strings (%s) with single quote marks. The CREATE statement produced from the above $wpdb->prepare is invalid SQL: CREATE TABLE ‘wp_classes’ ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT ‘0000-00-00 … Read more

wordpress add_submenu_page adds broken link

WordPress is doing exactly what you’re telling it to do. Refer to the Codex entry for add_submenu_page(). The functions arguments are like so: <?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); ?> So, you’re assigning the same string to $parent_slug and $menu_slug. For obvious reasons, these two need to be different. $parent_slug is the … Read more

Bug: Post needs to be updated twice when adding action for save_post hook

You’re doing several things wrong, and they’re all silly, avoidable, basic logic mistakes. Firstly, you’re not checking if this is an autosave. Autosaves do not save the custom fields, only the original core wordpress fields, like content, so an autosave will giv eyou unset/blank values. Add this to the top of your save function: if … Read more