Affichage des articles dont le libellé est Address. Afficher tous les articles
Affichage des articles dont le libellé est Address. Afficher tous les articles

samedi 12 novembre 2016

How to Stop Storing IP Address in WordPress Comments



After reading our article on how to allow anonymous comments, one of our readers asked us if it was possible to stop storing IP address in WordPress comments. Some site owners may want to do that to protect privacy of their users. In this article, we will show you how to stop storing IP address in WordPress comments.


Comment Privacy in WordPress


Pros and Cons of Not Storing IP Address in WordPress Comments


By default, WordPress logs and stores IP addresses of users leaving comments on your website. These IP addresses are permanently stored in your database.


The reason for storing IP addresses with each comment is to help site owners combat with unwanted comments or spam. Plugins like Akismet can block comments from IP addresses known to be exploited by spammers.


Unless your users are using a VPN service, their real IP addresses can still be found in your site logs. Most WordPress hosting providers keep an access log of all visitors to your website for a limited period of time.


On the other hand by not storing IP address in WordPress comments, you can improve privacy of commenters on your website. They may feel more confident about expressing their opinions knowing that your site doesn’t store IP addresses with comments.


Method 1: Stop Storing IP Addresses in Comments with Plugin


This method is easier and recommended for new websites and beginners.


First thing you need to do is install and activate the Remove IP plugin. For more details, see our step by step guide on how to install a WordPress plugin.


Once activated, the plugin will replace user IP with 127.0.0.1, which is an IP address typically used by localhost.


The plugin will not delete IP addresses stored with older comments. If you have older comments with IP addresses stored with them, then you may want to delete those IP addresses as well. We will show you how to do that later in this article.


Method 2: Manually Stop Storing IP Addresses with WordPress Comments


If you are comfortable pasting code snippets in WordPress, then you should use this method instead.


Simply add this code to your theme’s functions.php file or a site-specific plugin.



function wpb_remove_commentsip( $comment_author_ip ) {
return '';
}
add_filter( 'pre_comment_user_ip', 'wpb_remove_commentsip' );

This is basically the same code used by the plugin we mentioned in the first method. However, instead of storing 127.0.0.1, it leaves the IP field blank.


Remove IP Address From Old Comments


Regardless of which method you use to stop storing comments IP, old comments on your WordPress site will always have IP addresses stored with them.


If you have old comments on your site, then you may want to remove IP addresses from those comments.


We will show you how to do that by running a MySQL query on your WordPress database. It is really important to make sure that you have the most recent WordPress database backup.


Next you need to login to your WordPress hosting control panel and look for phpMyAdmin.


Make sure that you have selected your WordPress database by clicking on the database name in the column on your left hand. After that you need to click on the SQL menu.


Removing IP address from old comments in WordPress


This will bring you a text area where you need to enter this query:



UPDATE 'wp_comments' SET 'comment_author_IP' = '';

Click on the Go button below the textarea to run your query. That’s all, it will remove all IP addresses stored with comments in WordPress database.


Note: if you have a custom WordPress database prefix, then please adjust the wp_comments to your custom table prefix.


We hope this article helped you learn how to stop storing IP address in WordPress comments. You may also want to see our guide on how to add ask me anything anonymously in WordPress.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Stop Storing IP Address in WordPress Comments appeared first on WPBeginner.







How to Properly Add Your Business Address in WordPress



Do you want to display your business address in WordPress? Usually you can just type the address on your contact page or in a sidebar widget. But this approach is not search engine optimized. In this article, we will show you how to properly add your business address in WordPress with a map and other useful information.


Adding a business address in WordPress


When and Why You Need Business Address in WordPress


Usually most business websites add their address on their contact page. They use a contact form plugin like WPForms to add a contact form.


This works fine for most websites and online business. However when you have a physical business, its beneficial if you add your address in a search engine optimized format.


We recommend adding a contact form as well as other informations like maps, directions, phone number, and business hours in a SEO friendly format.


Let’s see how you can add your business address in WordPress in a SEO friendly way.


Video Tutorial



If you don’t like the video or need more instructions, then continue reading.


Adding a Business Address in WordPress


First thing you need to do is install and activate the Business Profile plugin. For more details, see our step by step guide on how to install a WordPress plugin.


Upon activation, the plugin will add a new menu item labeled Business Profile to your WordPress admin bar. Clicking on it will take you to plugin’s settings page.


Business Profile plugin settings page


First you need to select the Schema type. Schema.org is the standard micro-data vocabulary used by search engines to show rich snippets and additional information with search results.


Select a schema type that best describes your business.


Under the contact information section, you need to provide the name and address of your business. After entering the address, click on ‘Retrieve map coordinates’ link. The plugin will automatically fetch map coordinates for the address you entered.


Next, you need to provide a Google Maps API key. Generating this key is easy, click on the Get an API key link.


API key link


This will take you to the Google Developer Console website. You need to locate ‘Get a key’ button and click on it.


Get API Key button


On the next screen, simply click on the continue button to create a new project. You will have to wait for a few seconds as your new project is created.


Create a new Google Maps API project


Once your project is ready, you will be redirected to setup credentials. Enter a name for your project and the domains where this API key will be used. Use asteriks to white label your entire domain. For example,


*.example.com/*


Make sure to replace example.com with your own domain name.


API Credentials


After that click on the create button to continue. Your API Key will now be displayed in a popup.


Copy your API Key


You need to copy your API key and paste it on the plugin’s settings page.


Contact info section


You can now continue entering other contact information on plugin’s settings page. You can add a phone number, and select a page where users can contact you.


This could be a page with your contact form (See our step by step guide on how to create a contact form in WordPress).


Under the schedule section, you can enter your business hours. Simply click on add business hours button and then select days and hours you are open for business.


Enter your business hours


If you want to add multiple locations, then check the box next to multiple locations option. Click on the ‘Save Changes’ button to store your plugin settings.


Now that you are done creating your business profile, it is time to add it on your website.


Showing Business Address on Your Website


Start by creating a new page in WordPress or edit an existing one. You need to add this shortcode inside post editor where you want to display your business profile.


[contact-card]


Make sure to save your page and publish it.


That’s all, you can now visit the page to see your full business address information. It will have your business address, a link to get directions, phone number, and a map with your business location highlighted.


Business address page with contact information and map


You can also display your business address in a sidebar. To do that, go to Appearance » Widgets page, and you will see a new ‘Contact Card’ widget under the list of available widgets.


Simply add the contact card widget to a sidebar (See how to add and use widgets in WordPress).


The contact card widget allows you to choose which information you want to display in your sidebar. Simply check options you want to be displayed and then click on the save button.


Showing your business address in a sidebar widget


Adding Multiple Locations for Business Address


If you enabled the multiple locations option in plugin’s settings, then you can manage multiple business locations. Go to Locations » All Locations page and then click on Add New button.


Adding new business locations


You will now see the Add new location page which looks a lot like a post or page edit screen. That’s because your location is stored as a custom post type.


Edit location


You need to add your business name in the title and use the post editor to provide any description that you may want to add.


Next, select the Schema type and enter your contact details just like you did on the plugin’s settings page. You will also find a meta box to add your business hours.


Once you are done, you can publish your location.


All your locations can be seen on the custom post type’s archive page which will be found at:


http://www.example.com/location


Replace example.com with your own domain name.


Each location will also have its own permalink URL. You can go to Locations » All Locations and click on ‘View’ link to find a location’s page.


Location permalink


You can also manually add a particular location to a post or page using a shortcode like this:


[contact-card location=2]


Replace 2 with the location’s post id. See our guide on how to find post id in WordPress.


That’s all, we hope this guide helped you learn how to properly add your business address in WordPress. You may also want to see our list of 24 must have WordPress plugins for business websites.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Properly Add Your Business Address in WordPress appeared first on WPBeginner.