You should have the $post
variable (you may need global $post;
) from which you can get the post ID ($post->ID
). Then $perm = get_permalink( $post->ID );
should give you what you want.
https://codex.wordpress.org/Function_Reference/get_permalink
Related Posts:
- permalinks with get variables
- WordPress plugin how to run function when button is clicked
- Use an empty page to build custom plugin output
- Add Post and Comments menu no longer visible
- Creating a path in a plugin to call a function
- URL rewriting must be activated manually for my plugin
- 404 errors after plugin options update and category base change
- Why doesn’t flush_rewrite_rules run on plugin activation?
- Auto save permalink setting page with the plugin activation
- Help With Rewrite_Rules For a Custom Plug-In
- Append varible to url or set session
- How can I turn a custom wordpress page into a product page?
- rewrite URL based on selected taxonomy for post page
- Problem with dinamic add_rewrite_rule()
- Remove custom post type slug from URL and add taxonomy Slug
- add_rewrite_rule behaving strangely
- custom permalink’s rewrite rule for page id
- Show content without a post
- How to get post image root URL?
- How to create new content type and flushes rewrite rules without visiting the permalinks page?
- Forward an old url rewrite scheme to a new one?
- Changing permalink structure breaks link to .php file which generates files dynamically
- wp_insert_post generated mixed permalinks
- How to link to custom “archive like” page with custom permalink rules “dynamically”
- Add variables from rewrite rules to query var
- Home page is not loading, where in other pages are displaying on the site
- Get the current post/page URL with plain permalinks
- Adding body class in author page for custom role
- Author Meta in Author URL Link
- WordPress plugin how to run function when button is clicked
- Get (eventual) permalink from post within Edit Post in Admin panel
- WordPress permalink setting
- How to use permalink query to go to specific tabs in posts
- Custom rewrite, url path with parameters to a page
- Looking for WordPress System Diagrams
- How to output message during plugin activation
- How to provide translations for a WordPress TinyMCE plugin?
- Where do I start from
- Check the Version of an Enqueue’d External Library
- Change of query var in pre_get_posts not maintained
- Hook for post permalink update
- Menu Error in Admin Console with Custom Plugin: You do not have sufficient permissions to access this page
- How to Parse an Array of Elements in Gutenberg Block
- Load page template with custom content using a plugin
- Custom rewrite rule serves content, but returns 404 error code
- Will changing the ‘Plugin Name’ header in the next update of a plugin break anything?
- Performance of several get_option() calls
- How to edit mySQL wp_posts table from plugin php?
- Creating a Wordpess Plugin that writes data to a csv file. The data doesn’t show in the csv file?
- Problem with is_active_sidebar?
- Prevent Plugin from loading on ‘wp-admin / wp-login’
- Widget update function not saving values
- Getting admin notices working for plugin errors
- override pluggable.php functions
- An echo line in a transition_post_status action leads to “cannot modify header information – headers already sent by”
- get_the_excerpt() is not returning an empty string when the_excerpt is blank?
- “Plugin could not be activated because it triggered a fatal error.”
- How do I add a custom sub menu menu under Woo-commerce marketing?
- Does the order of sections in readme.txt matter?
- Add column in WP user but it goes wrong
- How to remove the current post from the query?
- Is file_get_contents() the only way for plugins reading local files OR does WP_Filesystem_Direct::get_contents() even work?
- how to get up row in wordpress with wpdb
- Preview plugin store details
- Hook into Jetpacks Publicize without using a post type
- Get attachments from a post
- How to remove default style of header in wordpress metabox
- TEMPLATEPATH without the theme name? No THEMEPATH constant?
- wp_update_post deletes post meta in CPT
- Checking a WordPress for OWASP top 10 vulnerabilities [closed]
- flush rewrite rules after plugin update?
- hook filter after the_content on a specific page
- The Correct Way to Use Nonce Field without Settings API
- Run command “composer install” when activating wordpress plugin
- Import user data using CSV
- How to submit/upload data to database and in specific folder?
- OOP plugin not working
- Plugin Options not saving options and doesn’t work
- WordPress dynamic widget by location?
- JQuery Slider – Similar to www.internetmarketinginc.com [closed]
- Development plugin to view and manage scheduled wordpress cron jobs?
- Add user managable titles to custom menus?
- Custom Icon for Plugin
- WP_Query order posts by category
- How to override supports of innerBlocks?
- Implications of creating a plugin that adds functionality to other developer’s plugin?
- why is update_user_meta creating arrays when trying to change the same value?
- How to avoid conflict if a plugin already have included open library?
- WordPress OOP get current user question?
- Including content into an add_shortcode() function
- Override WooCommerce files from plugin
- Add WordPress Meta Box saved form input to WordPress RSS feed [duplicate]
- What should I use instead of get_blog_option?
- post_results filter confused by pagination in sidebar and main section
- Children Shortcodes?
- Ajax functions – no access to wp-admin.php only online
- Create wordpress dashboard metabox which spans all columns
- add_filter adds output in the head
- How can i add insertion point between inner blocks in my custom block like core blocks
- Programmatically creating posts based on external JSON feed (asynchronously)