Tag - URL

How to Get the URL of Images You Upload in WordPress


Do you want to find the link or URL of images you upload in WordPress?

Sometimes you may need to get the link of an image to display it in other areas of your website or social media platforms.

In this article, we will show you how to easily get the URL of images that you upload to your WordPress site.

How to Get the URL of Images You Upload in WordPress

Finding a WordPress Image URL – Step by Step

WordPress automatically creates a unique URL for each image you upload to your website using the default WordPress media uploader.

Usually, a WordPress image URL includes your domain name followed by /wp-content/uploads/, date of image upload, and the image file name.

For example, an image named ‘travelaccessories.png’ uploaded to example.com in January 2019 will have a URL like this:

www.example.com/wp-content/uploads/2019/01/travelaccessories.png

Now let’s take a look at how to get the URL of images uploaded to your WordPress site.

First, you need to login to your WordPress admin area and click on the Media menu. Once done, it will open your media library where all your images and other media files are stored.

Next, you can use the search feature to find the image that you want to find the link of.

Search Image in WordPress Media Library

Once you click on the image, it will open a popup window with the image attachment details. You will see the image details in the right column and image preview on the left.

The right column displays all image details including file name, file type, upload date, file size, dimensions, and image metadata like image alt text, title, caption, description, image uploaded by, etc.

You will also see the image URL at the end. It is the link next to ‘Copy Link’ option.

Find WordPress Image URL

You can simply copy the link and use it anywhere you like.

If you open the image URL in your browser, then you can see the full size original version of the image uploaded.

Finding Your WordPress Image URLs from the Frontend

The method shown above lets you get the URL of any image uploaded in WordPress, whether it is published live or not.

If you want to get the URL of images already published on your site, then you can get it from the frontend itself. It is much easier!

Open a page or post where the image is published and locate the image. After that, right-click on the image, and select ‘Open image in new tab’ option.

Open WordPress Image in a New Tab

Once the image opens in the new tab, look at the URL in the address bar. That is your WordPress image URL.

Get the URL of Images in WordPress

Now you can copy the image address and use it anywhere you want.

It is pretty quick and straightforward!

How to Get the URL of GIFs, Videos, and PDFs in WordPress

As mentioned above, other media files like GIFs, videos, and documents like PDFs are also saved in the WordPress media library. You can easily find the URL of these files by following the same steps as shown above.

Go to Media » Library from your dashboard, and then click on a GIF, video, or document whose URL you want to see. After that, attachment details popup window will appear.

GIF URL in WordPress

You can get the attachment URL next to the ‘Copy Link’ option on the right column.

We hope this article helped you to learn how to get the URL of images you upload in WordPress. You may also want to see our guide on basic image editing 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 Get the URL of Images You Upload in WordPress appeared first on WPBeginner.



Source link

How to Change Author URL Slug and Base in WordPress


Do you want to change the author url slug and base in WordPress?

WordPress comes with built-in support for SEO friendly URL structure, also known as pretty permalinks. This feature allows you to choose URLs for your posts, pages, and categories by editing their slugs.

This feature also creates pretty links for author pages. However, there is no option for you to customize the author URL.

In this article, we will show you how to easily change the author URL slug and base in WordPress.

Easily change the author URL slug and base

What is a URL Slug and URL Base?

In WordPress terminology, a slug is a title of a publicly viewable page in WordPress formatted to be used in URLs.

It looks like this:

https://example.com/author/syed-balkhi/

In the example above, syed-balkhi is the slug and author is the base.

While users can change the slug and base for posts, pages, categories, and tags, its not possible to change the author URL in WordPress.

If you wanted to use ‘contributor’ instead of ‘author’ or if you wanted to change the author slug altogether, then you’re in the right place.

Let’s see how you can easily change author URL slug and base in WordPress.

Changing The Author Slug in WordPress

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

Upon activation, this plugin will add a group of options to each user profile page.

If you want to edit the slug of a user on your site, then you need to go to Users » All Users page. Next, click on the ‘Edit’ link below a username.

Edit user profile

This will take you to the Edit User screen. Simply scroll down to ‘Edit Author Slug’ section, and you will see a number of choices that you can use as author slug. You can even enter a custom slug.

Edit author slug

Once you have made the changes, click on the ‘Update User’ button and preview your site.

Now when you click on the author name in a post to view the author page, you will see that it is using the author slug you choose for them.

Changing Author Base

If you’re building a site where you want to change the author base from /author/ to something else, then you can do that as well with this plugin.

Simply head over to the Settings » Edit Author Slug page. Here you will see an option to change the author base and even choose different author base for users with different user roles.

Change author URL base

Once you are finished, click on the save changes button to store your settings. You can now preview your site and click on the author link to see the changes in action.

Setting up Redirects for SEO Purposes

Changing author slugs and base on an established website can have negative SEO ramifications especially if your author archives are indexed.

People coming to author pages from search engines will see a 404 error message. To avoid this, you need to set up redirects from old URLs to new author slug and base.

First, you need to install and activate the Redirection plugin.

Upon activation, head over to Tools » Redirection page. You’ll be greeted by the plugin’s set up wizard. You can follow the on-screen instructions to continue set up or click on the ‘Manual Install’ link to skip it.

Redirection wizard

Next, you will reach the Redirection page. From here, scroll down to the ‘Add new redirect’ section. You need to add the old author page URL as the source and the new author URL page as the target.

Redirect author page

Click on the ‘Add redirect’ button to save your changes.

The plugin will now automatically redirect visitors coming to the old author page to the new URL.

Now if you have also changed the author base, then you will need to dynamically detect those URLs and redirect them.

Let’s suppose you changed the author URL base to ‘contributor’. This is how you will set up the redirect.

Setting up a base redirect

Source: https://example.com/author/(.*)$
Target: https://example.com/contributor/$1

If you selected the author URL base to be created using the user role, then you will need to do this for every user role, except when the user role itself is ‘author’.

To learn more about redirects, see our guide on how to set up redirects in WordPress.

We hope this article helped you change author slug and base in WordPress. You may also want to see our list of most wanted WordPress tips, tricks, and hacks.

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.



Source link

How to Remove Website URL Field from WordPress Comment Form


Spam comments are a huge problem for many blogs. The biggest reason for spam comments is the desire to get backlinks by using the website url field in the WordPress comment form.

Since majority of the spam is generated by automated bots, you can easily combat comment spam by using free tools and plugins.

The trickier part is to discourage spam comments submitted manually by humans. These unwanted comments are submitted by actual users and are often off-topic, irrelevant, and add no value to the discussion.

In this article, we’ll show you how to remove the website URL field from the WordPress comment form. We’ll also explain why removing the URL field from the comment form will help you discourage spam.

Removing website URL field from WordPress comment form

Why Do People Submit SPAM Comments?

The short answer to that question is SEO or Search Engine Optimization. Let’s take a look at that in details.

Have you ever received comments from users like “Best WordPress Themes”, “Make Money Online”, or “MyBlogName” on your website? Why do they use such keywords instead of their real name?

By default, the WordPress comment form has four fields: name, email, website URL, and the comment box.

When displaying the comments, WordPress automatically hyperlinks the name of the commenter with the website URL they provided.

This backlink provides an incentive for blackhat SEO marketers and newbie bloggers.

They believe this tactic can help them get better rankings for specific keywords in search engines.

This technique does not work for SEO in most cases, but that hasn’t stopped spam comments.

This is why we have removed the URL field altogether from our WordPress comment form. By doing this, we have greatly reduced the number of spam comments on our site.

Real users will leave a comment on your articles whether they get a backlink or not. If someone doesn’t want to comment on your website because they are not getting a backlink, then you really have to question their intention in the first place.

That being said, let’s take a look at how to easily remove the website field from WordPress comment form. We will cover two different methods, and you can choose the one that works best for you.

Remove Website Field from WordPress Comment Form (Plugin)

This method is easier and recommended for all users.

First, you need to install and activate the Comment Link Remove and Comment Tools plugin. For detailed instructions, please follow our step by step guide on how to install a WordPress plugin.

Upon activation, you will see a new menu item called “QC CLR Settings” in the left sidebar of your WordPress admin panel. Clicking on it will take you to plugin’s settings page.

Comment Link Remove and Comment Tools plugin

From here, you need to check the box next to “Remove WEBSITE Field from Comment Form” option.

Once done, you need to scroll down to the bottom of the page and click on the Save Changes button to store your settings.

Since you are already logged in, you will not see the full comment form when visiting an article on your website.

You need to either log out from the WordPress admin area or open a new incognito browser window. After that, you can visit any post on your WordPress site to see the comment form without the website URL field.

Comment form without website URL field

Removing the website field will discourage users who only want to comment on your website to get a backlink.

However, the comments that are already approved will still have their author names linked to their website URL.

To remove them, you need to go back to the settings page of this plugin and check the box next to the “Remove hyperlink from comment AUTHOR Bio” option.

Once you save the changes, the links from the existing comments will be removed as well.

Manually Removing the Website URL Field From WordPress Comment Form

Some users always want to learn how to do things manually instead of using a plugin. The good news is that you can certainly remove the website field from the comment form with the help of a code snippet.

To get started, you need to take a full backup of your WordPress site. This will help you to restore your website files in case you break anything while editing the theme files.

Next, you need to copy and paste the following code to your theme’s functions.php file or a site-specific plugin:

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields)
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;

This code simply removes the website field from your WordPress comment form. You can visit a blog post on your website in a new incognito tab to see it in action.

We hope this article helped you to learn how to remove the website URL field from the WordPress comment form.

You may also want to check out our guide on how to add reCAPTCHA to WordPress comments to prevent spam comments. For more tips, also see our 12 vital tips to combat comment spam 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 Remove Website URL Field from WordPress Comment Form appeared first on WPBeginner.



Source link

How to Get Rid of /wordpress/ From your WordPress Site URL


Are you trying to remove /wordpress/ from your website’s URL? Sometimes beginners end up installing WordPress in a subdirectory, which causes /wordpress/ to appear in their website URL.

If you accidentally installed WordPress in a subdirectory and want to move it to the root directory, then you’re in the right place. In this article, we will show you how to get rid of /wordpress/ from your WordPress site’s URL.

Removing /wordpress/ from your WordPress site url

Note: The method shown in this tutorial works for other subdirectories as well.

Why You See /wordpress/ in Your WordPress Site URL

WordPress is quite easy to install and nowadays most WordPress hosting companies offer quick WordPress installers in thier hosting control panel.

However, some beginners who are manually installing WordPress may end up accidentally installing it in a subdirectory. Most often this subdirectory is named wordpress.

This happens primarily because users end up uploading the wordpress folder they find inside the official WordPress.org download.

Let’s take a look at how to easily fix this and get rid of /wordpress/ from your site’s URL.

Removing /wordpress/ from WordPress Site URL

If you have just installed WordPress and there is no content on your website, then you can just go ahead and start over.

Simply delete the current installation, and follow the instructions in our WordPress installation tutorial to properly reinstall WordPress.

If you have already added content to your website, then there are two easy ways to remove the /wordpress/ from your site’s URL.

Method 1: Change WordPress Site Address

If you have an established WordPress site, then this method is easier and quicker. The downside of this method is that your media files such as images will still use /wordpress/ in the URL.

First, you need to login to your WordPress site’s admin area and go to Settings » General page.

You will notice the ‘WordPress Address’ and ‘Site Address’ fields and both will have the same URL.

You need to change the Site Address option and point to your root domain, e.g. http://www.example.com and leave WordPress Address option as it is.

Once you do that, click on Save Changes button to store your settings.

Change WordPress site address

Next, you need to connect to your website using an FTP client. Once you are connected, go to the /wordpress/ directory and download the .htaccess and index.php files to your computer.

If you are unable to locate the .htaccess file, then you may need to force your FTP client to show hidden files. If you are using Filezilla, then you need to click on Server from the menu bar and select ‘Force Showing Hidden Files’ option.

Show hidden files in your FTP client

Once you have downloaded both files to your Desktop, you need to open index.php file in a text editor like Notepad. In this file you will find a line like this:

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

This line loads the wp-blog-header.php file which is required to load your WordPress site.

What you need to do now is enter the correct location of the file by replacing the existing line with this one:

require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );

Save your changes and upload both index.php and .htaccess files from your desktop to the root of your domain using FTP. The root folder is the parent folder with the wordpress folder inside it usually called /www/ or /public_html/

Root directory with a separate WordPress folder inside it

That’s all. You can now visit your website using the root domain, and everything will work fine. However, if you need to login to your WordPress admin, then you will still need to go to the wp-admin inside the wordpress directory like this:

http://www.example.com/wordpress/wp-admin

Method 2: Move WordPress to Root Directory

This method is more comprehensive and will permanently move your WordPress site from the subdirectory to the root folder of your website.

Step 1. Create a Duplicator Package

First, you need to install and activate the Duplicator plugin on your website. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Duplicator » Settings page and click on the ‘Create New’ button.

Create new duplicator package

This will launch the Duplicator wizard, which will create an installer package of your complete website. Click on the next button to continue.

Next, the plugin will run some scans. If everything looks OK, then you can click on the Build button.

Build duplicator package

Duplicator will now create a package and prompt you to download it along with the installer script. Go ahead and download both files to your computer.

Download duplicator package

Step 2. Create a New Database for a Fresh WordPress Install

You can use the existing WordPress database, but it is better to create a new one so that your old database is safe and unchanged. This way you could revert back to your site without much fuss if something goes wrong.

Visit your hosting account’s cPanel dashboard, scroll down to the ‘Databases’ section, and then click on the ‘MySQL Databases’ icon.

Database cPanel

After that simply provide a name for your database and click on the ‘Create Database’ button.

Create database

Cpanel will now create a new database for you. After that, you need to scroll down to the ‘MySQL Users’ section.

From here you need to provide a username and password for your new database user and click on the ‘Create a user’ button.

Create MySQL user

Now you need to assign database permissions to the new user.

Scroll down to the ‘Add User to Database’ section. Simply select the database user you created from the dropdown menu next to the ‘User’ field, then select the database, and click on the add button.

Add user to database

Your new database is now ready to be used for the fresh WordPress installation.

Step 3. Run the Duplicator Wizard

Now, you need to upload the Duplicator archive package and the installer file you downloaded earlier to the root directory of your website.

This will be the directory containing the /wordpress/ folder.

Upload Duplicator files to the root folder of your website

After you have uploaded both files, open the installer script in a browser window. You will need to enter your site’s root URL and then prefix it with /installer.php.

https://example.com/installer.php

This will open the Duplicator installer wizard.

Duplicator wizard

Check the terms and conditions box and then click on the ‘Next’ button to continue.

Next, it will ask you to provide the database information. Enter the information for the database we created earlier in step 2.

Connect your database

After entering database information, click on the next button to continue.

Duplicator will now unpack your WordPress database backup from the archive into your new database.

Next, it will ask you to update the site URL and Path. You don’t need to do anything here as it will automatically detect new URL and path. However, if it doesn’t, then you can manually enter it here.

New site settings

Duplicator will now finish the migration, and you will be able to click on the Admin login button to access your website on the new location.

Migration finished

Step 4. Set up Subdirectory to Root Folder Redirects

Congrats, you have moved your WordPress site from subdirectory to the root folder.

Now it is time to setup redirects, so that your users and search engines can find your website’s new location.

First, you need to connect to your WordPress site using an FTP client and then delete the old /wordpress/ folder.

Delete old wordpress subdirectory

After that, switch to the admin area of your WordPress site. Since you have moved it to the root of your website your WordPress admin URL will be like this:

https://example.com/wp-admin

Now, you need to install and activate the Redirection plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Redirection page. The plugin will now show you a setup wizard. Simply click on the continue setup and then finish setup button.

Redirection setup

Next, you need to switch to the ‘Redirects’ tab and add your new redirect.

First check the ‘Regex’ checkbox at the corner of the first field.

After that, For source URL you will add https://example.com/wordpress/.* and for Target URL you will add https://example.com/$1.

Redirect subdirectory to root folder

Don’t forget to replace example.com with your own domain name. Click on the ‘Add Redirect’ button to save your changes.

From now on all users accessing your website with /wordpress/ in the URL will be automatically redirected to correct posts with your new root URL.

That’s all. We hope this article helped you learn how to get rid of /wordpress/ from your WordPress site URL. You may also want to see our comprehensive guide to most common WordPress errors and how to fix them.

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 Get Rid of /wordpress/ From your WordPress Site URL appeared first on WPBeginner.



Source link