How to add Iframes in WordPress posts or pages

A friend of mine needed some help. He wanted to place iframes inside WordPress posts but WordPress removes those codes automatically. So I searched for solutions and found this pretty simple one. All you need to do is to add these 4-5 lines of code to functions.php located in your theme’s folder.

function add_iframe($initArray) {
$initArray['extended_valid_elements'] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]";
return $initArray;
}
add_filter('tiny_mce_before_init', 'add_iframe');

You can get there by going Appearance -> Editor -> Theme Functions (functions.php). If there’s no functions.php you’ll have to create one (to do so you must login to FTP or to your cPanel and create a functions.php file by hand in theme’s folder and then place this code in it. Don’t forget to open and close php segment.

Now WordPress will not remove iframes from your posts or pages!
Hope it helps!

Tags: wordpress iframe, iframe wordpress, iframe in wordpress, iframe wordpress page, iframes in wordpress, wordpress iframe in page, add iframe to wordpress

WordPress 3.5 custom media upload path missing

After WordPress 3.5 was released many of useful options were removed or simply disabled because of some reason. One of those options is possibility to define custom path where you want your pictures (and other media files) to be uploaded. This is really important in case – you want to use CDN or you want to use some other web server to serve that static content (both are simply a must for medium and big sites).

So if you go to Settings -> Media in your WordPress (versions after 3.5) you will see something like this:
wordpres uploading files no custom paths

And it should look like this (versions prior 3.5):
wordpress uploading files with custom paths

In order to enable custom media upload paths go to phpMyAdmin and open Database of your WordPress 3.5 installation, then locate table wp_options (could be different depending on your prefix) and then those two option_name inputs:
phpmyadmin wp_options
And change them according to your needs.

Same domain just different folder Example
upload_path to images
upload_url_path to http://www.yoursite.com/images

Subdomain example
upload_path to images
upload_url_path to http://images.yoursite.com
– then go to cPanel and setup that subdomain like this
cPanel subdomains
cpanel making subdomain

After setting those two values in phpMyAdmin those two forms will appear in WordPress so you can change it’s values if needed. If this helped you out please post some comments. Also if you need any help or experience any problems – feel free to leave a comment.


Link Manager missing after on WordPress 3.5

If you have upgraded your WordPress installation to version 3.5 or have just made a fresh installation of it you have probably noticed that “Link Manager” or simply “Links” in control panel menu are missing. No you’re not nuts – it’s gone! This is because the new WordPress by default doesn’t use Link Manager any more. It’s still available in the code and sites upgrading to WordPress 3.5 should still be able to use it (if they used it before) but new installations (or upgrades who didn’t used it before) must install a plugin called Link Manager. So they have basically removed that option from WordPress into a plugin so if you need that option – simply install that plugin. Here’s a link with lots of geek informations about it.

UPDATE:
You can also enable it just by adding this single line of code in theme’s functions.php:

add_filter( 'pre_option_link_manager_enabled', '__return_true' );
Tags: wordpress links missing, wordpress links menu missing, wordpress link manager, wordpress dashboard links menu missing

WordPress “Hack by DR-MTMRD” solution

A friend of mine contacted me today saying that his WordPress got hacked and it shows just this message “Hack by DR-MTMRD” on a white page. After investigating I found out that the hacker just added a blank widget with some nasty code. Solution was just to remove (delete) a widget. As simple as that. Hope that it will help someone who has this problem. Here’s the widget picture:

Hack-by- DR-MTMRD-solution

Tags: dr-mtmrd, hacked by dr-mtmrd, wordpress 3 5 hack

Solution for the custom fileds problem with WordPress 3.4.2

No you are not nuts there really is a problem with custom fields in WordPress 3.4.2. If you have just updated to current latest version of WordPress 3.4.2 and have found out that the custom fields are not updating and are broken – you are not alone. Its happening for everybody. Its a known bug for WordPress 3.4.2. Here we have a quick fix before WordPress 3.4.3 (or 3.5) arrives. WordPress developers are aware of the bug (http://core.trac.wordpress.org/ticket/21829). The next milestone version will be WordPress 3.5 but since this is a critical bug its already fixed in rev.21780 so it could be released early on 3.4.3 but we just don’t know when is that going to happen.

Until then you can use WordPress hotfix plugin that will take care of this bug:
http://wordpress.org/extend/plugins/hotfix/

All you need to do is install it in your WordPress. Login to wp-admin and go to Plugins -> Add New in search box enter hotfix and install the first plugin from the results list (plugin Version 0.9, plugin author: Mark Jaquith). That’s it!