New answers tagged

0

My issue was resolved, not sure if the connection to the database will work, but the error with wpdb connection was fixed. It was quite easy fix once I found out what the file dependence was. This is what you need to do: In the file you are trying to use wpdb you need to add code before you can use the class: <?php require_once('../../../wp-load.php'); ...


2

You should be using get_the_terms(). wp_get_post_terms() queries the db to get post term info, where as get_the_terms() returns the post term objects directly from the post term cache and only queries the db if that info is not available. By default, all post's terms are cached by the query being executed. EDIT I cannot comment (crappy mobile), but there ...


2

No, wpdb::delete does not handle anything other than WHERE field = X. You can just use the query method instead: $ids = implode( ',', array_map( 'absint', $ids ) ); $wpdb->query( "DELETE FROM table_name WHERE ID IN($ids)" );


0

Just realized, I was editing a different VERSION of the same post on the DB, hence that the changes were not reflected on the front end. Sorted now, thanks!


-1

Your solution is good and may work very well. But, there are few limitations. eg: 1) What about searching and sorting entries which are posted through your form? 2) What about exporting the data filled into your form to Excel or CSV or PDF? 3) What if you want to print the inserted data. All that can be achieved with Contact Form 7 + Save Contact Form 7 ...


2

This is actually not that hard, but you will have to excuse me for keeping it high level because this is just a stupid thing to do as all things which are security by obscurity. All you need to do is write your WPDB driver, which inherits the WPDB class. Place it in /wp-content/db.php file and make sure to initialize the global $wpdb object with your class. ...


0

WordPress uses a single table prefix for all tables and I always set a different prefix for each site I build to improve security. You could tell your client that security is even better if you do this for all tables.


1

This will delete the post, the post metadata, and any terms used on the post. It will not delete the terms themselves. The PHP script is similar to this but slower. Replace {{your CPT}} with the identifier for your custom post type and pop this in your database on phpmyadmin or mysql. DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ...


1

Thanks to @Samuel Elh I manage to get this done. I added this to my order-confirmation.php after I included config.php require ('../wp-blog-header.php'); global $wpdb; global $current_user; get_currentuserinfo(); $skrivID = $current_user->ID; Then the insert query, I added the table I wanted the user ID stored in and used the ...


3

You can use wpdb insert function. It's better in every way. It can care about data's escapeing itself and it's shorter. You can use your own query anyway but I would recommended this article for reading https://codex.wordpress.org/Data_Validation#Database


3

This doesn't sound like something coming from WordPress core. Quick search online got pretty slim results, but it seems to be asscociated with WP All Import plugin.


3

I agree with @Tom J Nowell: I'd suggest you remove it, or better yet just say "all rights reserved". But in the quest for answers, here's a suggestion using an option field to cache the years: /** * Get year range for posts. * * @return str */ function wpse_226627_get_copyright() { if ( ! $years = get_option( 'copyright' ) ) { $args ...


-2

You can simply copy the password from wp-config.php to reset the password of the user. Then, if you have phpMyAdmin, check that you can login with the user and the password. If you can't log in phpMyAdmin, check that the user has access to the database. If nothing work, there's probably something wrong with the server.


0

Make sure the new server host is the same as the old one ... some hosting services require you to put for example : vps.myhost.x1.com .... instead of localhost ... Edit : To be sure there's something wrong around your database! whether it is the IP, the host the mysql user/password ... double checkout from your wp-config.php and make sure you database has ...


0

The database prefix is probably different on the new server. Make sure they match or you can change the prefix accordingly in your wp-config file. The prefix line in your wp-config file looks something like this: $table_prefix = 'wp_';


0

If I understand it right your workflow is that you query posts (implicitly via normal WP mechanics), then display data from external database for them, but want to sort based on external data. This isn't trivial (without mirroring you don't want to do), since WP relies primarily on SQL over its own data for sorting. One of the ways you could implement it ...


0

Why did it happen? It's hard to tell for sure because there are lots of variables to consider: mistakes made in exporting or importing, MySQL version etc. This is rather specific MySQL database question and doesn't have much to do with WordPress itself. To get a specific non-speculative answer to question why, I suggest to ask it in SO or DBA with plenty ...


2

Try putting the table name inside quotes, like this SELECT * FROM `sparte-bogensport` Edit More info on why this happens: http://dev.mysql.com/doc/refman/5.7/en/identifiers.html


1

Personaly I would go with one table for all users. Having more tables with the same columns seems like a strange idea to me. The database will be a complete mess after you gwt more users. Make sure that the user_id is an index for the table and all your select/update/delete will be fine. The insert might have a very short but unsignificant delay after the ...


0

you can export tables of your database that you want to transfer, and Import to another database, then you should change Prefixes of those .


1

Scheduled Post Guardian solved it. I guess scheduling strictly from database is not possible.


2

You can not replace the URL in the database using ctrl+f or any other "direct" method. You have to do a search & replace in the whole database in a way capable of keeping the validity of serialized data. There are several tools to do that serialized seach & replace. For example: Plugins like Better Search Replace, Velvet Blues Update URLs or ...


0

I don't think Visual Composer is the problem. Have you installed a logging plugin? Open phpMyAdmin and simply delete them. They are likely a post type you dont use. You can use the following query DELETE FROM wp_posts WHERE wp_posts.post_type='suspected_posttype' Make sure you don't remove the posta that are used by your site. Check what post types you ...



Top 50 recent answers are included