How can I switch a WordPress option off from the MySQL database?

Hey Experts!!
I have a premium WordPress theme and their support is useless. They use the customize feature of WP.

I need to remove RTL support and I figured maybe I can do this from within the DB. I found the offending part however, I have no idea how to edit it. Can you help me switch this option to off or false?

s:16:"thim_rtl_support";

Open in new window


Obviously this column has a lot more code in it. I grabbed the snippet that I thought was most relevant.

Thanks in advance!
Leonard ZakoorSenior Front-End DeveloperAsked:
Who is Participating?
 
Chris StanyonCommented:
WordPress stores a lot of it's options in a serialized string in the DB. If these options are specific to a theme or a plugin, then you would normally set them in the WordPress admin. That would be the preferable way of doing it. Look at the Appearance -> Customize menu in your admin and you should be able to find the option in there. Look at the docs for your theme to see exactly where you do this (see my answer to your previous question)

Failing that, you could try editing the options string yourself, but if you get it wrong, you will break your site. Depending on how complex the options string is, you could just remove the entry, but you will also need to edit another part of it to ensure it is a valid serialized string. For example, take a look at the following options string:

a:3:{s:5:"width";s:3:"300";s:6:"height";s:3:"300";s:4:"crop";i:1;}

At the start, the a:3 says that we have an array with 3 elements. One with a key of 'width' which is a 5 character string. It has a value of 300, which is a 3 character string. Then we have a 6 character key (height) with a 3 character value (300). You can't just remove part of the string and expect it to work.

If you're savvy in PHP, then you could unserialize the string, remove any necessary elements and re-serialize it:

$str = 'a:3:{s:5:"width";s:3:"300";s:6:"height";s:3:"300";s:4:"crop";i:1;}';
$data = unserialize($str);

unset($data['width']); // remove the width key

$str = serialize($data);
var_dump($str);

// 'a:2:{s:6:"height";s:3:"300";s:4:"crop";i:1;}'

Open in new window

Copy the output of the var_dump back into your DB.

If you go this route, make sure you have a solid backup of your DB (and you know how to restore it).
0
 
Leonard ZakoorSenior Front-End DeveloperAuthor Commented:
Thanks Chris. I set the option from 16 to 1 and it seemed to have the desired effect. The site didn't break either. Thanks again bud!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.