How to Remove the Website Field of WordPress From the Comment Form?

We found so many spammers try to leave their url in the field of Website, and use Name as their keywords. How to prevent the spammers doing so then? For example, how to prevent them to leave thir url? Let me share my tips with you. Continue reading “How to Remove the Website Field of WordPress From the Comment Form?”

Get WordPress Current Category URL and Link

<?php
global $wp_query;
$cat_obj = $wp_query->get_queried_object();

// Get the ID of a given category
$category_id = get_cat_ID( ‘Category Name’ );

// Get the URL of this category
$category_link = get_category_link( $category_id );
?>

<!– Print a link to this category –>
<a href=”<?php echo $category_link; ?>” title=”<?php echo $cat_obj->name; ?>”><?php echo $cat_obj->name; ?></a>

 

Mass Delete trash post from WordPress

Q:I want to mass delete my trash with 2000+ Posts in it. Is there a mysql command to do so?

A: Please backup before running the query, i’ll not take responsibility if something goes wrong as a result..

DELETE p
FROM wp_posts p
LEFT OUTER JOIN wp_postmeta pm ON (p.ID = pm.post_id)
WHERE post_status = ‘trash’

Join is optional, removes entries from the meta table (if they exist).

Check your data base table prefix also, if it is not wp_, you have to change it to your table prefix.

Tested under MySQL 5.1 in Phpmyadmin.

How to change wordpress post author?

Here is the perfect steps to change wordpress post author:

1) Login into wordpress admin area.
2) Click on Edit in the Posts section.
3) Select the posts for which you need to edit the author details.
4) From the top there is drop down for bulk actions -> select edit and apply.
5) Now, you can change author, comment, status, pings, sticky, categories etc..,
6) After changing the value of author..click on update posts..

That’s it!

Only show for en Language

Now more and more adsense accounts are banned due to useless trafice, especially non-English speaking countries trafic, we can add the following code to test our visiters Computer language:

$_SERVER['HTTP_ACCEPT_LANGUAGE']

<?php
$a = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
echo $a;
?>

We can get different results, such as en-US, en-Ca, zh-CH. We can use substr() to get certain numbers we need. Continue reading “Only show for en Language”

Change Hostgator MySQL Password

Sometimes we want to change hostgator mysql database user password, or we have to change when we forgot the password. How to do?

Very simple infact, first delete the user name of the mysql and remake it, but make sure you use exactly the same name when remaking.

then bind the old database name to the new database user name.

next modify the user password in your software config file, for example, if you use wordpress, you have to modify wp-config.php; if you use vbulletin forum, just modify config.php

Mass Delete Comments from WordPress

Pending links, Spam links, or Trash links with a WordPress powered blog can grow really quickly and most is spam. Word Press allows you to remove such comments but only 20 at a time. What if you have thousands pending links, spam links or trash links need to be deleted? You will wast a lot time if you delete them via WordPress Blog own functions. Here we will teach you how to delete them via phpmyadmin! Continue reading “Mass Delete Comments from WordPress”

wp-includes\taxonomy.php on line 1518

I am using XAMPP, and wordpress 3.0.4, today when I want to show all post, the following error message shows:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32768 bytes) in D:\xampp\htdocs\wp\specsexpert\wp-includes\taxonomy.php on line 1518 Continue reading “wp-includes\taxonomy.php on line 1518”

WordPress Ad Code Skills

Sometimes we want our ads codes show differently at our wordpress blog. Say we want to show adsense codes different types at different place, say homepage, single post. Simple!

The following code will show your ad code one at single post and single page, and ad code two at other places: Continue reading “WordPress Ad Code Skills”

Category ID from current URL nicename and show some posts name

We can use the following code to get category ID from current URL nicename:
We can use the following code to get category ID from current URL nicename:
<?php
if(is_category() || is_single()){
 $category = end(get_the_category());
 $current =$category->cat_ID;
 $current_name = $category->cat_name;
}
echo $current_name . ” has id “.$current.” and is called “.$current_name;
;
?> Continue reading “Category ID from current URL nicename and show some posts name”