The developer’s reference is a great place to start. You’ll find get_permalink in wp-includes/link-template.php.
You might want to look into wp-cli wp post list --post__in=1 --field=url should do the trick as discussed in wp-cli issue#2727
Also, there’s the rest-api to consider. The best solution for getting the permalink might be to just post/cURL a request to WordPress’ rest-api to get the permalinks you want.
This question might be a good place to start: WP JSON list all permalinks
For example, you could do something like the following:
curl https://example.com/wp-json/wp/v2/posts/<id> or curl https://example.com/wp-json/wp/v2/pages/<id>
& then find the guid / permalink from there.
Related Posts:
- how to get permalink structure with php
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- WordPress theme showing blank page
- Permalink changes after several minutes after saving post
- What is the proper way to call a function (from functions.php) on a link click?
- redirect 301 with special character like WIX site “#!”
- How to extract URLs from wordpress taxonomies
- How to automatically flush permalinks?
- Execute wp_after_insert_post after the permalink is customized
- Modify the permalink structure for a specific category
- Processing data and redirecting with query string
- PHP code in page template vs functions
- Apply class to every paragraph that holds image?
- username_exists() function can’t be access without logging in
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- Check if page parent has certain template
- Delete post revisions on post publish
- Add/echo div with Analytics-Code to function in functions.php
- How do I list the_tags() into HTML data-attribute
- WordPress if (is_page) translation on certain page
- Check if term object is in array
- Highlight Current Tag in wp_tag_cloud
- Getting rid of role=”navigation” in the Home Page Pagination
- How to use return in my custom function instead of echo
- How to remove the excerpt in the Dzonia Lite theme
- Get first URL from post content
- Setting custom canonical urls
- Trigger popup in a php if/else statement
- Setting a cookie upon specific URL visit
- WordPress custom slug (endpoint) and compare all links
- get post based on category chosen in drop down – The ajax method
- how to make separate field in wordpress user_data_
- How to output a PHP file values by shortcode?
- Set the background to a default image if there isn’t a specified “featured image”
- Logged in user ID as post ID
- WordPress Access allowed to fewer pages till user logs in
- WordPress returning 404 for multisite pages
- different id for same element visual composer [closed]
- Tax query in pre_get_posts not working
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Filtering a function’ output for a new continued function
- Shortcode to find and replace URL
- Deleting Certain terms from appearing on the front end as links
- first instantiated SimplePie object cosumes 5mb?
- Theme not calling Jquery properly
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- WordPress redirect redirecting too many times or not at all
- How to make jquery count down timer function manually editable
- Hierarchical taxonomy list with modificated term links
- Add value to new attribute inside WordPress menu items
- Please show me how to use an if/else statement in combination with wp_enqueue
- If Array Values Match Another Array’s Values, Then
- entire JS folder not loading in a WP theme
- Open and closed function [closed]
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Else/If Statement to Display Photo Descriptions
- Count foreach and display in menu php
- Strip from or something better?
- Display additional page templates and a sidebar on plugin activation
- Permalinks: site.com/post-tite vs site.com/post-id/post-title for SEO and Speed
- Remove role of user after X days
- Add a Metabox checkbox to the Page Edit screen of wp-admin , which only certain roles can see and Makes only certain roles able to Edit said page
- Custom URL for multiple categories hierarchy
- how to replace h1 entry title with h2 in category pages only
- How to unset a function from a action inside a class, that is called in another class
- Create a new account on site B with data from the purchase of site A
- Why is the current page loaded in the pop-up window and not the specified one?
- if get_post_meta is empty echo a placeholder or shortcode
- PHP multiple forms, same page, isset($_POST[]) not working?
- Outputting post content to jQuery .html() string
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- post_exists stops working in a scheduled event
- Where do I implement this display of User Meta Data, and how to put it in a table?
- How do I stop my form from adding code to current page URL instead of re-directing. Been stuck for days
- image on homepage disappeared due to change of permalink name
- Add ID to output only for first option
- Issue encountered while trying to keep website private
- Display text of price (minus 20%) on every product page in a sentence.
- How do I get the featured post to share on Social Media and show on Individual Post pages?
- How to make 2 similar functions more efficient
- Some links broken after updating WordPress version
- Echo multiple tasks if a common function exists
- Add end mark at the end of every article
- Custom meta box save values issues – Deprecated: Function ereg() and more
- Ninja Forms – pull in some post related information
- Functions are causing errors
- Global variables and re-use
- Link to external page has wordpress blog-url inside
- AJAX: WordPress filters inside $html do not work as intended
- Adding multiple conditional tags in a function?
- Why a class property becomes empty?
- how to goto specific page number including title with permalink
- Hide category by tag
- How do I stylize selected comments?
- “acf/load_field” Critical error upon saving/updating WooCommerce products [closed]
- How do I make a shortcode to display Dokan seller badge list?
- Function extension
- Developing a “fallback” for empty wp_query results based on post dates
- How can I process a form submission from an HTTP POST request?