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
- WordPress Infinite Scroll without using any plugin
- Facebook Comment Count
- How to remove a metabox from menu editor page?
- How to overwrite youtube embed?
- New Plugin Review
- Problems with function on function.php
- How to add SVG icon above product tab title
- Generating add_settings_section() calls dynamically
- Remove query string specific key value
- is_page “range” for if statement?
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- jQuery not defined
- Converting HTML Template to WordPress Theme
- Error when adding excerpt to the content through functions.php
- Add data attribute to each li in menu
- Prev/Next child navigation for current page modifications?
- Adding rel tag to all external links
- How can I apply_filters from inside a function?
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Populate editor with some content of a page with a page template
- I want to load in a new class but only if the current page is single-movies.php
- Skt full width basic slideshow problem
- Create custom permalinks to show Custom Post Type’s relationship?
- Way to add captions to gallery images by code
- Need to put a script above tag in header.php – WP 5.7.1
- How to make container class in PHP
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- How to show/hide php table rows based on the content of custom fields
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Prev/Next Links Broken on Static Front Page Pagination
- Isotope Drop Down Categories Filter Function
- What is the best way to define constant options for a theme?
- How do I check or test a WordPress Auto Year Change Script?
- Is there a built-in function to generate multiple paragraph tags based on a string with new line separators?
- How to add no follow to specific links?
- Function for simple math doesn’t work what am I doing wrong? [closed]
- How to hide the author box of a specific user?
- Add date before entry title in Twenty Twelve
- How do i wrap woocomerce attribute in list?
- Removing files programmatically
- Class property seems to lose scope, attached to save_post action?
- Nav-Menu not showing up
- Show different website layout if no sidebar added
- get_template_part function and add images
- Need advice on theme customizer and child themes
- How to make sure relative URL works when site is not on root domain?
- How to pass hook variable to function?
- Defining multiple categories for showing latest posts
- exclude custom post type from running a function
- Migrating site, only header shows
- The additional fee for the COD payment method not visible in the front-end
- PHP identify duplicate words in a text string against a list of words
- How to access all meta data for RSS feed?
- Why Is Number of views on wordpress single post wrong?
- Change Language Title Pagination on Subdomain non Multisite
- remove specificly the last tag in all posts
- How to use Page link field with is_page()
- How to hide a child category and show his parent category
- How to add and subtract user meta values after post meta update
- Multiple AJAX handler functions conflict in functions.php
- add another variable to php function
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Gutenberg block don’t save rich text content
- Adding custom field to product category and show it to shop/category shop page
- Change lost password url to a mailto URL in WordPress
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- Remove span tags from WooCommerce Downloads page
- Send POST request to Flask app from functions.php file
- 500 Error, Get custom field and returning it
- How to add typehints to function in functions.php when argument is an object?
- How to auto-generate random numbers in username?
- Remove generated category and tag class names from woocommerce product & blog listings markup
- is_user_logged_in() not working in homepage
- Custom Post type Ajax search results
- How to add a custom class for iframe by embed_oembed_html
- remove public static function wp_link_dialog()
- Find the method which AJAX GET calls
- str_replace not preserving whitespace
- Calling PHP function doesn’t work in index.php
- How to set up an auto delete post?
- Display a post based on its metabox selection
- Calling the Next category link on an archive page – WordPress
- Metabox Input Not saving
- Trouble using wordpress functions in a pop-up modal form
- admin-ajax.php loading many times
- Cross origin ajax request always returns 0 when calling get_current_user_id();
- echo php values in table – strange behaviour, not all values are shown
- Merging two excerpt functions to work with conditions
- wp wp_register_script function results type parameter missing
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- Suppress errors when using global function
- how to create twitter card without plugin in wordpress website?