previous_post_link
and next_post_link
both output the link directly, which won’t work in your case because you’re trying to assign the result to a variable. Use get_previous_post_link()
and get_next_post_link()
instead-
function add_pagin( $content ) {
if ( is_singular('post') ) {
$content .= get_previous_post_link() . get_next_post_link();
}
return $content;
}
add_filter( 'the_content', 'add_pagin' );
Related Posts:
- Is it possible to remove next-post / previous-post with out creating a custom template?
- How do I Make a Theme “plugin-ready”?
- add_filter and remove_filter added before and after wp_query
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Finding the paragraphs in content
- How to filter the_content() & include content from template
- WordPress custom taxonomy check box to dropdown
- Can / should a widget plugin define its own Widget Area?
- Override category archive page title (not the head title)
- Custom signature appears twice on page
- Caption Shortcode: what filter to change the image size?
- WordPress permalink setting
- add_filter adds output in the head
- Password field is empty when using wp_signon();
- How can I replace content in the WP Admin area before an admin page is rendered?
- How to change title tag at page after loaded post?
- Caching the_content calls
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- Run Shortcode of post’s custom field in functions.php / Plugin
- How do I create plugin or theme using MVC pattern?
- How to limit number of number of categories displayed by categories widget
- How to filter content for specific content variable
- PowerPress mobile media player
- When is the proper time to minify css and js with git workflow?
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- How to hide or rename “X” and “x-child” references in website source?
- How to Get Current Custom Post Type Associated Taxonomy Term
- Plugin templates vs Parent Theme
- Selectively update themes in WordPress multisite
- Using ob_get_content to get_search_form puts into infinite loop
- Widget HTML Display Problem
- Valid filenames for add_action’s first parameter
- How do I access the menus produced by Dashboard > Appearance > Menus
- How to create a backend for a custom theme?
- Proper way to replace the_content only for pages created by custom plugin
- wp_nonce_field displaying twice
- WordPress class, using add_action to call member function does not work
- Redirect to another page using contact form 7? [closed]
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- What happens when two or more plugins use the same hook?
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- How to Control CSS of Admin On Creating only a Specific Custom Post Type
- Can’t change the style of a submit input type? [closed]
- How to get all queries’s results after they have executed?
- Make a plugin page out of influence of the theme’s style
- Update Data parameter of a wp_localize_script() call
- Custom entity search and display
- WP Plugin Running before jQuery
- How to get the post excerpt using post object?
- Template directory in plugin
- get_the_tags with separator control?
- How to only load css for used blocks on frontend
- 400 Bad Request, in wordpress theme development, wp_ajax
- Remove an action by extending class and replacing it
- Add child pages to submenu automatically
- hook filter after the_content on a specific page
- ECHO Executing 4 Times In Head
- Bind a function with its own argument to show something dynamically after every content
- Why in this archive page that call query_posts() function show only the last 10 posts?
- my own SVN for a plugin/theme
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Why enqueue styles on hook?
- Getting a WordPress Debug Strategy
- Inserted double quote when prepending to the_content
- unable to wp_enqueue_script(‘suggest’);
- Drawing the line between theme & plugin on large scale bespoke projects
- Apply styles to blockquote element with the WYSIWYG editor
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Hook add_attachment error
- Why would you use esc_attr() on internal functions?
- Invalid hook call on save, not edit when using swiper slider
- Proper way to use useSelect
- Call to undefined function is_home() or any conditional tags
- Conditional Generation of Image Sizes using add_image_size
- How to add plugin options in wp editor page
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Add function after the_content
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Update variable value via add_filter
- How to find where an object first instantiatiation
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- Shortcode conflicts
- Full documentation about $args for register_rest_route?
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- modify show UI of a registered taxonomy
- Using function from enqueued .js file in theme in plugin?
- Configure WordPress to Generate Scheme-less Relative URLs
- Does WordPress default CSS have Grids?
- Gravity Forms Anchor only on Front Page?
- Using HTML links within translatable string
- How to find list of all functions bind to a particular hook from my plugin?
- How to resize WordPress images on upload to specific height and width without cropping it
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- Create fixed static pages
- How to get terms for taxonomy
- Information on plugin adding text when a post, page, or other such is displayed
- WP_NAV_MENU filter targets all menus