Tag Info

Hot answers tagged

3

While I am a big fan of tweaking wordpress as much as it could because it allows us to, I think the best way forward is to have the best algorithm before coding. Reading your question, I came across " Actually, I have created two custom post type named 'truck' and 'drivers' ". Issue: Linking two post types requires extra work as you are doing because ...


2

I don't think wpdb actually cares to have a way for explicitly closing connection. From search through code base the WP's unit tests (not actual core code) are doing the following (note the difference in API used since latest WP versions): if ( $wpdb->use_mysqli ) { mysqli_close( $wpdb->dbh ); } else { mysql_close( $wpdb->dbh ); } unset( ...


1

You should not use this technique to change the URL of your site : WordPress sometimes stores URLs in serialized strings. You find/replace will corrupt the serialized data and discard the whole content. You can use interconnect/it search and replace tool to change the domain without any risk. This tool even allow you to run a dry test to check what will be ...


1

This is an answer I re-porpoised from a question that was abandoned. I thought this will help you solve this issue By default, all custom post types are excluded from the main query, that is why you don't see any posts when going to the front end author page. To accomplish this, you will need to modify the main query to include these post type/s. For this ...


1

First, you need to to find out what your current version of MYSQL... WordPress requires MySQL 5.0 or greater Since its a VPS, I'm assuming its a linux installation. Just type mysql -V on the command line and it will return your MYSQL version. If the version is compatible with wordpress, this message may be a "plugin/theme related" message. Look at your ...


1

Wordpress doesn't work this way. If you want to work with a framework like Wordpress, you should obey its rules! Of course you can add a database record like this, but it is a really bad approach. Try some plugins for creating and saving forms in Wordpress like Ninja Forms or Quform. You can even do it yourself, but its not recommended for Wordpress ...


1

Yes you can. Straight from the codex The $wpdb object is not limited to the default tables created by WordPress; it can be used to read data from any table in the WordPress database (such as custom plugin tables). For example to SELECT some information from a custom table called "mytable", you can do the following. $myrows = $wpdb->get_results( ...


1

The second one is revision. It means the changes that you made, but didn't save. Wordpress saves that as revision post. There might be more than one revision post if you make more changes without updating the post. You don't need to worry about that. It's all in background and won't affect you in any way.


1

If you remove revisions, your blog is going to be identical for the user. Only in the backend, you won't have access anymore to your post history. You can also use plugins like https://wordpress.org/plugins/wp-optimize/ to do that. Ref: http://codex.wordpress.org/Post_Types#Revision


1

You can do that by two ways. One is by a function or other by SQL query. In your function just get all the posts having post_type = <your-custom-post-type> and delete those . Just add that function to theme init method. You can also do that through just SQL query. Query may be like below. SELECT * FROM wp_posts WHERE ...



Only top voted, non community-wiki answers of a minimum length are eligible