How to delete all records from or empty a custom database table?
I would just modify Q Studio example to: global $wpdb; $table = $wpdb->prefix . ‘table_name’; $delete = $wpdb->query(“TRUNCATE TABLE $table”);
I would just modify Q Studio example to: global $wpdb; $table = $wpdb->prefix . ‘table_name’; $delete = $wpdb->query(“TRUNCATE TABLE $table”);
Ok – so I solved this. Here is what appears to be the problem. Comments are disabled by default for custom-post-types. This happens even if you have them enabled in the overall settings To fix it, all I had to do was the following: In SETTINGS > DISCUSSION uncheck the “Allow people to post comments … Read more
Yoast’s plug-in is actually a very good example if all you want to do is add menus. Basically, the admin bar is just an alternate set of links to the same plug-in admin pages you have in the sidebar. To add the top-level SEO menu, Yoast does the following: $wp_admin_bar->add_menu( array( ‘id’ => ‘wpseo-menu’, ‘title’ … Read more
I will answer question 2, be aware that some values in the database are stored in serialised arrays. For example, if the length of your URL string changes and it’s in a serialised array, then you need to update the index for it. You can use this PHP script to update all the values in … Read more
Install the plugin WP Native Dashboard. Then you can set one language for the front-end in your wp-config.php and each user can choose another one for the back-end. See Change language of comments template for details and a screenshot.
If each plugin/theme functions on its own, then you should probably drop the the library in every theme/plugin. Then just check to see if it a class or function from the third-party library exists before requiring it. <?php if( class_exists( ‘SomeClass’ ) ) { // require/include here } or <?php if( function_exists( ‘some_function’ ) ) … Read more
Concerning documentation there is this blog post on the Make Blog: Responsive Images in WordPress 4.4 To increase the 1600px limit mentioned in the comments try this: add_filter(‘max_srcset_image_width’, function($max_srcset_image_width, $size_array){ return 2000; }, 10, 2); Finally as already mentioned you should fix your calls to add_image_size add_image_size(‘news-large’, 1024, false); needs to be add_image_size(‘news-large’, 1024, 0, … Read more
WordPress local development environment: Local development environments could apply to developing any type of application but there are some specific WordPress gotchas that could hinder your transition from local to dev. The goal of a local development environment is to mimic as close as possible the production environment and allow seamless transition. Matching URL If … Read more
The default metaboxes are registred in the file wp-admin/includes/meta-boxes.php. There you can find the function post_categories_meta_box() which will generate the taxonomy metabox. Currently there is no hook available to filter the output. But you can do one of the following: Use remove_meta_box() to remove the existing category metabox and register your own with add_meta_box(). Copy&Past … Read more
Probably not. The recommended way to get your enhancements into the plugin is: Send your fixes to the developer and ask her to merge them into the original. If your changes are rather personal customizations, this won’t happen. If the plugin is written in a strict OOP style you can create a second plugin which … Read more