globalize $post to get the current post’s data. also, you want get_permalink, which returns the permalink, rather than the_permalink, which directly echoes the permalink.
function abcd_add_contents($content) {
if (is_single()) {
global $post;
$extra_content = get_permalink( $post->ID );
$content .= $extra_content;
}
return $content;
}
add_filter('the_content', 'abcd_add_contents');
Related Posts:
- How to call a plugin function from index.php
- Rewriting every url
- Passing URL parameters to WordPress pages and pretty url
- Publish Post After Click On A Link
- How to get the custom page get_permalink?
- Custom url structure for custom template
- Add a Custom Permalink option in the Permalink Admin Screen?
- How to get the permalink of a page when loading my plugin
- How do I add a custom sub menu menu under Woo-commerce marketing?
- How to change custom post type pemalink Hierarcy
- Modifying Author Link to add Author Meta in URL
- Perform internal redirect in WordPress?
- flush_rewrite_rules() not working with update_option_{$option}
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- How to embed a new string in url?
- Make get_permalink() work outside the Loop using filters
- help intercepting save_post through plugin
- WordPress Frontend Page using Plugin
- Child theme modifications not showing up
- Create new page in wordpress plugin which doesn’t exist
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- Changing author slug for a custom role without using plugin
- Custom author page for custom role
- Custom role not listed
- Is it possible to change plugin’s Admin Panel Url?
- Coming soon pages with rest of site in maintenance mode
- claim a permalink and all sublinks in plugin
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- How do you debug plugins?
- Add multiple plugin directories
- What are the differences between WPINC and ABSPATH?
- Where do I put the code snippets I found here or somewhere else on the web?
- Delete WordPress plugin Repository
- Giving Multiple Authors Access to a Plugin’s WP.org Repo
- How to stop showing admin notice after close button has been clicked
- Add section (add_settings_section) to a custom page (add_submenu_page)
- How to save the values of checkbox to the register setting?
- Creating a default Custom Post Template that a Theme can override
- Load plugin selectively for pages or posts, etc
- Handling jQuery Component Collision
- How to get Login Error messages on a custom template
- Can i create two tables at single time while installation of custom plugin?
- Finding WordPress sites using my plugins
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How do I check if my $wpdb->insert() was successful?
- Claim Listing functionality – how to send email to users when their claim has been approved or denied
- Creating a theme option page?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- WordPress 4.0 Cookie Authentication to avoid nonce error when publishing a post and page
- Add post thumbnail from external image with plugin
- Alter post slug by a filter that is fired just after a post is created
- Where is the source code that makes the “all” array grabs filters in the $wp_filter?
- How to add nofollow on all external links without plugin?
- How does WooCommerce display a custom comment_type in Comment Admin?
- How to Build a Movie Library in WordPress 3.x
- Options page not displayed under Settings menu
- Is it possible to add an action to the currently running action?
- Created Widget Not Showing up on Admin Panel
- How to display public user profile with 2 additional fields? (GitHub source code included)
- How to include and use custom class files in plugin?
- Action on post publish
- OOP: Display warning and deactivate the plugin if PHP version is less than 5.4
- wp_enqueue_scripts not working inside shortcode
- How to prevent action in ajax request, when in admin side?
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Social sharing post’s shortlink instead of permalink
- unzip a folder on specific location and delete the zip file
- Handling jQuery Component Collision
- Scope for PHP Variables Assigned in functions.php or a plugin
- How to make a custom field as an editor in wordpress?
- Why is an action callback function from an instance of a class always invoking the same function from an instance?
- Plugin not appearing after uploading it via FTP
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Changing labels of status filters for post grid
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- Plugin version is not showing up in wordpress.org plugin directory
- JS Support Ticket – Auto create WP account
- Own plugin corrups plugin-activation
- wordpress plugin is not activating from widget
- uninstall.php file in Plugin to clean DB
- CSV file generation failing
- finding whether request is for post, and post id
- Append varible to url or set session
- How to get specific setting by settings_fields()?
- Save / Show multi line text in metabox
- Python with wordpress plugin
- Prevent duplicate records in plugin table
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Owl Carousel2 image not displaying full width when using Stretch row and content, Stretch row and content(no padding) in wordpress
- Passing an array from shortcode-function to filter-function
- Get Time Taken By Each Action Hook in WordPress
- Best way to initiate a class in a WP plugin?
- WP_Async_Task doesn’t appear to be running asynchronously
- Buidling a translate plugin for wordpress
- Force language in translate function
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- How to remove custom post type and add category and post name
- wp_footer hook only working on homepage not in other pages
- TinyMCE Styles Dropdown not adding html tags other than span