_wp_link_page()
returns a HTML string and not just the URL address of the link. So, if the link’s URL address is http://example.com/blah/2/
, then _wp_link_page()
would return:
<a href="http://example.com/blah/2/">
..i.e. it returns the opening a
tag for that link.
So replace the following:
$content = preg_replace('/(<img(.+?)\/>)/i','<a href="'.$link.'">$1</a>', $content);
..with this:
$content = preg_replace('/(<img(.+?)\/>)/i', $link . '$1</a>', $content);
Related Posts:
- Paged posts – how to use numbers and next/previous links?
- Single Page View for Paginated Posts
- Check if on last page of paginated post using wp_link_pages
- How to ignore or disable nextpage tag?
- wp_link_page – wrap current page element
- Display only the current page number and another numbered page in pagination
- Insert pagination links – wp_link_pages() – before filters on posts
- WordPress wp_link_pages show only next/prev link
- Post Pagination Customization (wp_link_pages) Editing Navigation
- Adding range to wp_link_pages()
- Limiting number of visible links displayed with wp_link_pages
- Post Pagination Modifications (wp_link_pages)
- How to customize wp_link_pages()?
- Custom wp_link_pages for paginated posts | Next page randomly
- Making a Killer wp_link_pages
- Changing pagination list class
- How to show a single post on the front page but have normal paging?
- Pagination resolving to first page only
- Pagination of RSS2 feed
- Modifying WP_LIST_AUTHOR Functions to output all users in a grid (and Paginate)
- How to style current page number (wp_link_pages)?
- Problem: ( kriesi ) pagination doesn’t work in homepage [duplicate]
- Category pagination shows same posts
- category/category_name pagination 404 error
- get_query_var(‘paged’) giving same result
- Show content only on front page?
- Getting 404 on taxonomy page
- Why am I getting a 404 on anything past page 1 of my query?
- Getting pagination for second loop to work on single.php
- When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?
- 5 posts per page from single category, paginated
- WordPress custom URLs for pagination pages
- Home page not obeying post per page setting on the first page only
- How to add pagination to a single post
- How to deal with equal & similar arguments for a function?
- WordPress rewrite rules for pagination on search page
- Styling the_posts_pagination With Font Awesome
- Pagination on 2nd loop
- How can I show a multipage post as a single, wrapped post?
- Why does pagination go to a blank page when navigating through home.php?
- Pagination with $_POST and $_SESSION
- wordpress is converting ?page=2 into /2
- Pass additional parameter in the URL
- Template hierarchy about pagination after front-page.php
- Add pagination to my custom loop [duplicate]
- Pagination with WordPress default gallery?
- How do i improve my custom pagination?
- Default pagination is broken when use ‘static page’ as ‘front page’
- Paginate results from data fetched through array
- make a pagination that show posts by date
- Adding pagination on template page wordpress
- Pagination on custom post type not working if permalinks set to rewrite url
- Theme Option not Working Inside a Function
- search with pagination not working as expected
- Pagination Not Working on `WP_Query` Archive Page
- Cannot go back to the first paginated page using pagination links
- Remember form field values with page navigation
- How do you choose to display specific posts/pages by parent url
- Custom category.php paging shows the same posts
- Automatically adding a link to the next page link before ” tag in posts?
- Unable to Change “Pages:” Before WP_LINK_PAGES
- Hide content after going to page 2 of archive, show content when back at first page
- Add pagination to this following template
- split wordpress loop into columns of categories and associated posts
- How Change URL in Pagination pagebreak no plugins wordpress?
- How is the Page Splitting implemented in the theme?
- Why the page number does not appear in splitting post?
- Use of rewind_posts() cause pagination to break
- Pagination not working in custom post type but perfectly in posts
- Paginate Images To Similate Map Drill-Down
- Custom pagination with URL parameters
- how to add pagination to a popular post custom page?
- Add pagination – syntax error when copy/pasting
- Remove “Page” from Category archive
- Problem with Paging 404
- Pagination not working past page 3 on archive page of category
- Using the_posts_pagination with offset adds extra empty page
- get_next_posts_page_link adds Inexistent directories
- Search, pagination, the last pages leads to 404 page
- Pagination is not working in custom page template
- Pagination in Archives
- Only show pagination when post count exceeds show post
- Pagination – linking back to base page – Page 1
- Custom Pagination shows same posts on each page
- Numbered pagination showing all numbers instead of paginated blocks
- Show next and previous page number
- Search pagination link redirecting to a link that doesn’t work with pagination
- Search URL gives 404
- Adding pagination to query for custom page
- Main page paginate_links issue
- WordPress creating 404s under blog tags
- Removing template part when not on homepage if / else
- Paginate template name
- How to reduce the number of pages in pagination
- foreach pagination
- Always show Next and Previous button in wp_link_pages ?
- paged query leads to 404? [duplicate]
- Pagination only working on index page not on a template page
- Separate page for pagination possible?
- Why does WordPress keep directing or forcing my pagination?