WordPress has a function called url_to_postid
that may work in this situation. You can try the following (untested):
<?php
$url = htmlspecialchars($_SERVER['HTTP_REFERER']);
$back_id = url_to_postid($_SERVER['HTTP_REFERER']);
if( $back_id > 0 ){
$back_title = get_the_title( $back_id );
echo "<a href="https://wordpress.stackexchange.com/questions/211840/{$url}">Go back to the {$back_title}</a>";
}
Related Posts:
- Using php to overwrite or replace title tag, while using yoast [closed]
- Two title tags in my header
- How can I add title attributes to next and previous post link functions?
- How to add subscript and superscript in WordPress page titles
- add_theme_support( ‘title-tag’ ) in conflict with custom titles function
- Modify page title format (when using title-tag)
- Empty title on front page/Home
- Changing “Enter title here” based on post format
- How to get page’s ID if I know the title only?
- WordPress i18n-friendly preg_replace post title
- How to make a H1 different then the Title?
- How to set custom title of custom page template?
- How do I edit the tag without using the deprecated `wp_title()` function?
- Change Default Custom Fields Metabox Name
- Get wp_title() from page ID into a variable
- How can i remove JUST the title tag from wp_head() function?
- Remove site name from tag
- SEO meta description and title tag Yoast SEO
- What code do you use to generate the text to go into the HTML title tag?
- Multiple Conditions for Child Page Title
- How come my first blog post and my home page have the same title?
- Where do I change the ACTUAL title tag that is set in the header.php
- Why doesn’t YoastSEO allow me to set the title/description for the home page? [closed]
- Change title tag dynamically or within plugin?
- Remove site name from title post
- Hide price & title in store thumbnail dispay? [closed]
- Change all Post titles into [Title Case] format
- How to modify a title tag in genesis?
- How do I set the blog name?
- How to Change Title Attribute to be different from Page title
- How to sanitize post title with commas
- Add anchor text to php
- Adding schema.org itemprop to WP4.1 Title Tag
- Set max title length – similar to excerpt length for outside of single.php
- How to edit title on Edit post pages?
- How do I shorten the title lenghs with Elementor theme? [closed]
- Remove Title of youtube video
- How to Customize “WordPress > Error” Text in Titlebar?
- How to add H4 tag to the_content filter (after content)?
- Page title is showing category name as well in the google search results
- change title separator
- Change page title dynamically before header is rendered
- Why is a category/ tag name prefixed to title of every page?
- Where does Yoast SEO plugin sets the site/page title?
- For better digital journalism, how to store a second title and excerpt?
- After I set the title, it over-wrote all the titles for the individual pages
- Wrap the_title_attribute in a H2 within a Conditional Tag?
- set title attribute in wp_get_attachment_image()
- Title tags show twice
- Setting page title and keywords from PHP code
- Anyway to specify what should appear in in .php file?
- How can I override the post title when a post is set to sticky? [closed]
- disallow publish posts with special title
- Print post title with markup
- How to get current page title inside a page’s template
- Remove tagline from the HTML on the home page without plugin?
- How to remove Title and CSS styling of title from particular page
- Delete a repeated part of post title in WordPress
- Prefix the title tag, if IP address is the dev server
- how to set alt & title for featured image get_the_post_thumbnail
- How to add publish date in the title
- Change meta data of pdf file
- How come I get internal server error even with try catch for get_the_title in functions.php?
- How can I add a title to this ‘maintenance mode’ function?
- Print title page in header of a specific page
- How to give titles to custom post type as “unique” incremental number?
- Front page displays different than all other pages?
- Modify link options when hovering over post title
- How to disable publish button if post title exists
- Wp Admin Bar Customizing Labels
- Array to modify post titles
- Title how does page no work in Twenty Eleven
- strtolower
- Getting the Image Title (not the post title)
- how to change the title of tag page?
- I want to add number after post tittle for each category
- Add text to the first “title”=>get_the_title($post->ID), and shorten
- Special characters in post_title replaced by ‘?’
- Limit title length
- Remove title bar from post-new.php
- How do you change the title of the Edit Post page?
- How to get page title () in a different order?
- Reorder title tag and description tag with wpseo_title and wpseo_metadesc
- How can I remove an unwanted character from the main page’s title?
- How do you keep the title of a post. to NOT show when publishing the post?
- Custom title when using shortcode
- Change font and Colours in Menus
- Setting Page Title Yoast
- How to Implement Category.php page title in wordpress custom template?
- Why I can not modify the appereance of my title web site in google? [closed]
- Comparing pre-saved post_title to post-saved post_title
- Add Placeholder in WordPress Editor Content Box
- How to delete posts which have same title?
- Append text after wordpress title
- Remove post title in catogory page
- Change Bookmark Name without Changing TITLE Tag [closed]
- reformat entry-title with two different styles
- Trying to get more space removed from my header
- how to put breadcrumb under Title [closed]
- How to fix special characters when the title or excerpt is shortened [closed]