You can do a conditional and return the post’s URL by using a get_the_permalink() in conjunction with is_single():
add_filter( 'the_content', 'my_filter' );
function my_filter( $content ) {
// Check if we're inside the main loop in a single post page.
if ( is_single() && in_the_loop() && is_main_query() ) {
return $content . get_the_permalink();
}
return $content;
}
Related Posts:
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- if plugin is active? check if plugin is enabled or not?
- WP showing “warning: call_user_func_array()”, What to do?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- Saving Plugin settings to the database
- Change destination author link
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How can i change an image’s author?
- New Plugin: Post update pushes a copy as a revision
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Display a text message if the field is not found and not if found
- Scope for PHP Variables Assigned in functions.php or a plugin
- Add a plugin before main container
- Missing argument 3 for wp_register_sidebar_widget()
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Shortcode button dosent work for all posts. Work for first post only
- wordpress plugin is not activating from widget
- Edit Yoast SEO breadcrumbs output [closed]
- Override Plugin Script Fucnction in WordPress
- Replacing a plugin function with a custom renamed function doesn’t work
- How to call WordPress function other files
- All sites themes functions.php have been changed
- Conditional attributes and logic per product category
- WordPress get_avatar function not correct working
- What is @Action in WordPress?
- Check if variable is set in filter
- execute function after one completed
- JQuery prepend a function
- Why can’t I call a (member) function from within a foreach?
- wp_enqueue_scripts
- How to get specific string/value from an array? php [closed]
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- WordPress Stock Update Programatically
- How can I fetch data from another website to my wordpress website with mysql database
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- How to translate wordpress error message
- All custom widgets are not showing in widget area at the same time
- Add the_post_thumbnail_url to a shortcode in function.php
- same user role or copy the user role to be same as the other role
- Adding a Tag Parameter / Filter to My Shortcode
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Checkbox show / hide output result
- Custom Logo Link WordPress
- How to convert Currency from USD to other IP Based currency in Php function
- WordPress Custom Hook with Class method
- Attempting to list all product categories and the price range of all products within them
- Allow a particular user to access a particular plugin?
- WP Function does not trigger on Webhook API Call
- Cookie value changes back to previous value after changing
- Creating an array from form inputs before it is posted to the options database
- Post source link plugin – small modification
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- adding dynamic/multiple slug values in ‘option_none_value’
- How to create algorithm for ordering posts in WordPress?
- How to assign a specific service to a specific provider based on location
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Block plugin update possibilities (but not by hiding notifications)
- post id or permalink auto-incrementing number and reset everyday
- Is admin section completely customizable in terms of styling?
- Return function results within shortcode
- How to make the first letter of a post title uppercase, in a plugin?
- Compare Ajax Data Results
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Soflyy WP All Import Custom File Download Issue
- Update (a function) post’s featured image as soon as $image_url changes
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Nested DIV’s across functions in PHP, do not seem to work
- WordPress environment not loading properly
- Every time I use wp_get_current_user() my plugin breaks
- How to echo a plugin’s function into a template?
- How to replace native comment_count with Comments Evolved aggregate count
- It possible to implement an adhoc php web application with wordpress?
- Cannot access variables within a widget
- Is there any wordpress function to update a random post every 10 minutes?
- Calling an custom field from theme option at the frontend
- WordPress function to add text
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to add a handler for a button in plugin?
- Contact Form 7: custom validation [closed]
- date function not correctly returning date
- Doing action based on input from options menu
- Showing author box on post detail page
- How use Dynamic hyperlink on each wordpress post?
- How to prevent page load on form submission
- Move related products after product summary? [closed]
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Woocommerce disable checkout on specific day
- Requires PHP version 5.3.0
- PHP if url extension action=discussion condition use [closed]
- Make plugin admin page visible to other roles
- How to change all the urls of the WordPress site?
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- I want to allow certain file types on dokan upload files
- Read page- or post-content across different builder-plugins