Don’t forget to use esc_url()
echo '<a href="'. esc_url( $link ).'">Welcome</a>';
Also try this: get_permalink( get_the_ID() );
Related Posts:
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- Removing rel=”nofollow” from links posted in Post Content
- How should I add links to other pages/posts from my post?
- How to do set post permalinks using 6 digit random unique function?
- How to handle broken links created by permalink/slug changes?
- Link to date_query results in WordPress
- When WP_Query only returns 1 post, how do I automatically redirect to that post?
- Internal linking to posts permalink fail because of spaces and stripe at postname
- How to link post titles on page A to its posts on page B?
- My posts section for logged in user
- Make assigning post to a specific category equivalent to assigning it to all categories
- Modifying the permalink href for posts with jquery
- Read more link not working [closed]
- After the local installation of an old WP website I can see the homepage but I can’t access to the articles, why?
- Permalink issue with new blog posts > getting 301 redirect
- Select only post id and meta value with WP_Query
- Lost draft under all posts and drafts
- Switch to page template when using post permalink
- Get user categories with most posts in it
- Random ajax load only works with posts_per_page set to -1
- Trying to use AngularJS with WordPress without any API
- get_adjacent_post by language
- How to : pagination in 3 different custom loops on the same page
- How could I change my Permalink from blog to custom structure? [closed]
- Visting slug for ‘post’ post type shows 404 not archive?
- Any way for get_next_post() to use the actual post order instead of publish order?
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- how do i add posts-page slug before posts slug in permalinks
- Exclude the first ‘n’ number of posts of a tag from home page?
- Query posts and return XML
- Is it possible to paste a link without tags and make it directly a link in a post?
- how to change the number of posts returned in a specific loop without making it global?
- Query Posts With Over 1000 Views
- posts_per_page option limits the number of Gallery items
- List authors with the last post title and order by last post date
- How to order posts by meta_value and title
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Retrieve post ID from “querying” URL
- wp_query random post
- wp_posts table: safely remove unused columns to save database storage
- hiding permalink in admin if the user is subscriber
- Why does WP_Post not contain its permalink?
- Query Posts by Custom Field
- the_permalink() not working in a root installation
- Adding a blog archive with pagination using WP_Query
- How to get Tags with specific post id
- how can i change WP main archives loop to sort by name or title
- Using wp_list_pages() after calling query_posts()
- how to get post order by post id wp_query?
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- Possible to alternate between two loops
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- How to display all posts divided/ordered by post date? [closed]
- Why Query is returning empty array?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Show post content and title in diferent divs using WP_Query using a loop
- Why are my paginated posts always returning the same results?
- Ignore latest two posts
- Is it possible to use WP_Query to only pull posts with attachments?
- Second get_permalink inside loop points to wrong URL
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- How to add a class to edit_post_link?
- Every second post different class in blog view
- Loop doesn’t exclude the specified category in home page
- Get posts with multiple categories
- Do not show children of a category
- Display posts of specific category term
- Can’t get full post title if there a spaces in title
- Print out last 3 blogposts
- why the same code got different results when using query_posts in functions.php and index.php
- Query posts by Author and/or by Tag
- Query for first 3 posts to change the look and feel
- Adding a user’s ID behind the tag ref link address
- How to get posts published on the latest date?
- Why posts array is empty?
- Can’t understand why sometimes a [caption] field appears
- All Posts Linking to Author Posts directly
- Custom Permalink Structure for Pages & Posts
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- search blog posts by author first name and or last name
- Show metabox value last post excerpt, title and link
- On what hook can I get the queried object’s final state?
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- custom word in custom permalink structure
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- wp_query with ajax
- How to give classname to post if post has no content?
- Custom wp-query in wordpress rest api
- How to generate/create link automatically on every word of post in wordpress
- WP_Query: Show 10 posts in date order, first three random