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
- How to change a user’s password programatically
- Plugin upgrading: Widget settings
- Create a table in custom plugin on the activating it?
- How would you require and automatically download dependent plugins?
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- Redirect to settings page after install
- What is the correct way for a theme to support plugin UIs?
- How does WordPress determine the primary plugin PHP file?
- translation does not work with text_domain
- Editor not displaying dynamically after clicking on the button
- flush_rewrite_rules() not working on plugin activation
- Determine plugin name from within plugin_action_links filter
- How to submit documentation with plugin
- Having separate plugins and themes folder for multi-site setup
- Placement of Code in Plugin for hooking `save_post`
- gallery option is not available in media upload box in costum theme option page
- Many plugins making WordPress run slow by design?
- How can plugins have their own pages?
- Reusable functions and tools (Framework)
- Add keywords meta to index.php page
- How to create ‘import dummy data’ option in custom wordpress plugin
- Creating a plugin to sanitize comment and the url field before display only
- Object Oriented Plugin not working
- What are the specifics of WordPress development I need to know? [closed]
- Insert data from .sql file in wordpress plugin
- How can i get the post’s full html source by its ID?
- Force file download on plugin activation
- How to change the name of the “edit my profile” link in the WordPress admin backend
- execute function after one completed
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- How to Resize the Custom Post Images?
- Why is it important to check for isset and is_array before checking in_array in this example?
- Upload files to the plugin menu
- Class or function wrapper for plugin code
- Licensing a Plugin [closed]
- Add a function call after content automatically?
- Don’t load the theme for a page FROM a plugin EDITED
- WordPress Feed Creator Name Tag Full Name Instead Of First Name
- WordPress plugin with its own “site”/theme
- Ajax request sends url rather than data
- Why the internal link get converted into a comment?
- Security of a WordPress Plugin
- Grouping imported products and showing variations based on selected product
- Remove Zero Money From Previews Order woocommerce
- How to display the category name in the tab and post inside the tab in WordPress?
- Shortcode do not return the right data in post
- Ultimate Members Default Post Layout problem
- Performance considerations – postmeta table versus new table for custom posts with foreign keys?
- How to define the slug for my custom plugin?
- Avoid WordPress header bar when form submission using admin_post in the frontend
- Set “Open in New tab” as default option
- Generate and send ICS file through WordPress
- Field salespeople task management
- Is it possible to create duplicate post on other site (either push, on publish, or pull, periodically)?
- WordPress Boilerplate Plugin doesn’t see callback functions for add_settings_field and add_settings_section
- Hide ‘add to cart’ button for some products [duplicate]
- Add Flatr button to Sharing option
- Change localization only for plugin
- How to get author developer link on plugin page
- wp_schedule_event need to deactivate plugin changing recurrance
- A more elegant way to handle notices/warnings
- Redirect default login page to a custom page [duplicate]
- appointment plugin doesn’t display all appointments
- Doing action based on input from options menu
- Create New Admin Menu Section – Like how custom post type works, in a way
- Customize Multi-Column Tag Map to fetch specific post-type
- Combining JS files to one script
- What are the downsides of using bootstrap in plugin development?
- How to generate a responsive output from plugin?
- The plugin generated xxx characters of unexpected output during activation
- Upload Image to desired directory through plugin
- How to add custom html to the Media > Attachment Details modal?
- How do i fix this error?