WordPress creates shortlinks for each page and post
I used “Remove WP version and shortlink” plugin and it removed the shortlinks. https://wordpress.org/plugins/remove-wp-version-and-shortlink/
I used “Remove WP version and shortlink” plugin and it removed the shortlinks. https://wordpress.org/plugins/remove-wp-version-and-shortlink/
Auto shortlink for file uploads
bit.ly Offers URL redirection service with real-time link tracking. Sorry, I do not think it’s possible and even if it was I do not understand why you need it.
Mostly from https://stackoverflow.com/questions/7118823/check-if-url-has-certain-string-with-php Check if the url has your string, then spit something different out based on it. Perhaps something like… $url=”http://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’]; if (false !== strpos($url,’forms.woo.com’)) { echo ‘?pageurl=” . home_url() . get_the_ID(); // there”s your page id url } else { the_permalink(); // plain old permalink }
You want to replace a string within the result, you’ve got it in the function’s arguments. Nothing WordPress-specific here. $post_url = str_replace( ‘http://’, ”, wp_get_shortlink() );
get_post_permalink won’t work for draft or pending posts. But there are a couple workarounds you could use. Here there is a similar post with two options.
Without a plugin or service? You can’t. There’s no such thing. From the documentation for wp_get_shortlink() (emphasis mine): This function exists to provide a shortlink tag that all themes and plugins can target. A plugin must hook in to provide the actual shortlinks. Default shortlink support is limited to providing ?p= style links for posts. … Read more
Shortlinks work only for logged in users
There are 2 solutions to your problem: You can go to the Jetpack menu in your dashboard and disconnect, then reconnect to WordPress.com. It will force an update of your Jetpack settings. You can contact the Jetpack support team here: http://jetpack.me/contact-support/ They can update your Jetpack settings for you.
Have you tried the get_page_by_title function? You can use like <?php echo get_permalink(get_page_by_title(‘My Post Title’)); ?>