Changing Table Prefix for an Existing WordPresss Site

This is pretty straightforward. You can use phpMyAdmin or MySQL Workbench to change the prefix on all the tables at once, or you can do it one-at-a-time with a tool like SequelPro. If you need to run the SQL by hand, the syntax is… RENAME TABLE `old_name` TO `new_name`; Once all the table names are … Read more

WordPress mysql table double prefixes

1) In order to check what kind of prefix used by current installantion you can goto wp-config.php in a root directory and find line with $table_prefix = ‘PREFIX_HERE’; variable 2) Backup the DB before making any action! 3) Additionally check if other tables with different prefixes/name_patters are not used by badly-written 3rd party plugins. They … Read more

writing inner join in wpdb

thanks for your time and thanks to @czerspalace I started the query with double quotation and then separate it with a single quotation and after looking at the echo output I found that there’s no spaces between From and table name this is the correct way $pending_reservations = $wpdb->get_results(‘ SELECT booking_calendars.cal_name FROM ‘.$wpdb->prefix.’booking_calendars AS booking_calendars … Read more

PHP code inside shortcodes

You can not put PHP functions inside your shortcode. However, you do not need to. You can just use your foreach-loop to create the html and store it in a variable, for example $shortcodehtml. So, afterwards, you can call echo do_shortcode(‘[O_U user_name=”operator” blocked_message=”This page is restricted for guests.”]’ . $shortcodehtml . ‘[/O_U]’); The better version … Read more

Custom Plugin For Converting CSV To MySQL

To start with, you need to fix the define of CSV_PATH: define(‘CSV_PATH’,dirname(__FILE__)); as without that, $handle will be false – no file opened or data read. …then before you run it take another look becaue $col4 and $col5 are not set anywhere either…