rss search

next page next page close

How to increase memory limit for WordPress

Last night I got the following error: Fatal error: Allowed memory size of xxxxx bytes exhausted when customized a theme in WordPress. I uploaded a php file with the following content:

<?php
phpinfo();
?>

When I ran it, I saw memory_limit is 32M. I decided to increase it to 64M.  I tried the following:

1. Add the following line to wp-config.php file:
define(‘WP_MEMORY_LIMIT’, ’64M’);
2. Update PHP.ini to add the following line:
memory_limit = 64M ;
3. Add the following  to an .htaccess file:
php_value memory_limit 64M

When I re-run the php file, memory limit still shows 32M. I searched lunarpages hosting that hosts my web sites and found the following link: increase php.ini upload limit

I did the similar thing for memory limit and it worked.

In .htaccess file, add the following lines

suPHP_ConfigPath  /home/username/public_html

<Files php.ini>
order allow,deny
deny from all
</Files>

In php.ini file, add the following:

memory_limit = 64M

 

 

 


next page next page close

How to Increase the Maximum File Upload Size in WordPress

After I upgraded to WordPress 3.9.2, I noticed I have trouble to upload images or videos bigger than 2MB. Looks like “Increase Upload Max Filesize” and “PBP Increase upload limit” plugins don’t work anymore. Here is how to fix the issue.

1. Go to wp-admin directory on your WordPress
2. If you have php.ini or php5.ini file in wp-admin directory, please add two lines like the following. In this case, I want to increase maximum file upload size to 250MB.
upload_max_filesize = 250M
post_max_size = 250M
3. If you don’t see those two files in wp-admin directory, please create them and add those two lines. If you knew your host uses php5, you could just only create php5.ini.


next page next page close

Brute force attack on WordPress site

A brute force attack involves trying any and all combinations of commonly used password to gain access to an account or access to the administration section of your WordPress site.

I tried Login Ninja WordPress plugin before. It gives an option to send notification on failed login. From notification emails, I could see my WordPress site is hammered by a brute force attack for “Admin” Username. To protect your WordPress site, you should delete the “Admin” user for your WordPress site. You could create a new user and assign this new user as “Administrator” role then delete the original Admin user.

There are a number of security plugins you could take advantage. For example, Login Ninja mentioned the above. Here are some free security plugins to get you started:
1. Limit Login Attempts
2. WP Login Security 2
3. Login Security Solution
4. Bulletproof Security
5. Factor Authorization by Duo Security

Most hosting companies provide password protect your web page. You could password protect your wp-login page.


next page next page close

How to Exclude Posts of Certain Tags from WordPress Homepage

I was building my blog and posted some old posts for “Memory” session. I don’t want them to show up in my blog home page. Here is how I did it.

1. Go to Appearance -> Editor in your WordPress dashboard and then select Main Index Template.
2. Add following example code to only show posts with tag ids: 53, 50, 47 and 51. If you want to exclude posts with certain tag ids, use tag__not_in.

<?php
if (is_home()) {
global $wp_query;
$wp_query->set(“tag__in”, array(’64’,’50’, ’47’, ’51’, ’65’, ’67’, ’69’));
$wp_query->get_posts();}
?>
Here is the simple way to find tag ids without writing a sql qurery.
1.Login to your WordPress admin panel.
2.In the main navigation menu, go to Posts -> Post Tags.
3.Hover your mouse over the Tag name you need the ID for.
4.Keep an eye on your browser´s status bar at the bottom left of the screen.
5.Within the link you will see the Tag ID number as shown in the image below.


next page next page close

Open link in a new window for wordpress custom menu

I added the link to our photos webstie in the memory menu in my blog. But I would like to open it in a new window when users click on it. Here are steps to enable it in wordpress.

1. Click Appearance > Menus
2. Click on Screen Options (top right)
3. Check “Link Target” checkbox under “Show advanced menu properties” heading.
4. Select the appropriate target for custom link created.


next page

How to increase memory limit for WordPress

Last night I got the following error: Fatal error: Allowed memory size of xxxxx bytes...
article post

How to Increase the Maximum File Upload Size in WordPress

After I upgraded to WordPress 3.9.2, I noticed I have trouble to upload images or videos...
article post

Brute force attack on WordPress site

A brute force attack involves trying any and all combinations of commonly used password...
article post

How to Exclude Posts of Certain Tags from WordPress Homepage

I was building my blog and posted some old posts for “Memory” session. I...
article post

Open link in a new window for wordpress custom menu

I added the link to our photos webstie in the memory menu in my blog. But I would like...
article post