Monthly Archives: September 2014

How to Rewrite posted by with Custom Fields in WordPress

When user post’s any post in the wordpress without registration , their name can be saved in the custom fields but during the display in the front end , posted by section we won’t be able to display his/her name. Here is the solution how to show the posted by section with the custom fields.

Go to fuctions.php and just add the following filter with the author name.


add_filter( 'the_author', 'custom_author_name' );
add_filter( 'get_the_author_display_name', 'custom_author_name' );

function custom_author_name( $name ) {
	global $post;

	$author = get_post_meta( $post->ID, 'news_posted_by', true );

	if ( $author ){
	   $name = $author;

	return $name;

Make sure the custom field news_posted_by exist in the corresponding post.

How to Use Shortcodes in WordPress Text Widgets

Just add the following code in the functions.php file

add_filter('widget_text', 'do_shortcode');

If you also like to know more about theĀ 8 best wordpress email marketing plugin, then visit the link

How to change the Site URL and Home URL on a WordPress Site

When do you need to change the site URL and home URL in wordpress

1. When you move your site from your PC to online or simply when you move your project from one location to another.


Simply , Add the following lines in wp-config.php to update site URL and Home URL as

1. wp-config.php


2.Add the following lines in functions.php


3. Use the following sql query to update the site url and home url as

UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, '','');
UPDATE wp_posts SET post_content = replace(post_content, '', '');
UPDATE wp_postmeta SET meta_value = replace(meta_value, '', '');