The first thing that i am not getting is $exclusive->y ? can you please share custom field settings that you have created?
And the second thing that i have found, you must have to put global $post; in the first line of the function :
add_filter( 'the_title', 'wpb_new_title', 10, 2 );
function wpb_new_title( $title, $id ) {
global $post;
if('post' == get_post_type($id)){
$exclusive = get_field('exclusive', $id); // pass the id into get_field
$title = $title .', ' . $exclusive;
}
return $title;
}
I have added a title on the default post. see the screenshot of the settings and the view page.
in viewpage my post name is Hello World and i am adding “,test additional title” from the filter hook.

Please check, If it works for you. also please share the details that i have mentioned.
Thanks!:)
Related Posts:
- How to reference PHP in Javascript
- How to call a PHP function from Javascript in WordPress
- How to store the_title() into a variable to reutrn the value, not just echo it
- How do I make my function add variables/values to the $post object?
- WordPress Infinite Scroll without using any plugin
- How to preserve PHP modifications while upgrading WordPress?
- Calling a method from functions.php on a click of a button
- How to use WordPress (PHP) functions in AngularJS partials files?
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Understanding WordPress child theme custom JS loading
- How do I know what variables are passed in a filter/action and what their meaning is?
- Click loads template via ajax
- javaScript in section of WP API
- How to speed up admin-ajax.php in wordpress
- Adding tawk.to code just before body tag on functions.php file
- How do I fetch all comments per post via WP REST API?
- Slide in Panel WordPress Post
- Pass PHP variable to JavaScript without inline JS
- Count the number of times the search form template gets included on a page
- Putting PHP variables into javascript [duplicate]
- How do I display a user’s previous orders as a select box option on a product?
- Trigger popup in a php if/else statement
- Use menu link or onClick to set a variable
- How to put a variable in a instance in the widget
- Populate dropdown with Child Pages based on Parent Page chosen
- remove wp floating submenu in wp dashboard
- Get value from shortcode to do something
- How to complete two other input fields, completed the first
- JS file work only in index page
- dynamic dependent select dropdown
- Ajax load more button for comments wordpress
- Noscript not working as it should in wordpress site
- Tell WP register script to load a script only when the entire page is loaded
- Creating WordPress Shortcode with Variable
- Why i can’t get custom fields value or post ID via Ajax?
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- Overide Variable in Child Theme
- PHP variables in a post?
- Time Delay a URL Redirect for Specific Page
- WordPress User Meta value variable into Google Gauge Chart
- How to send a php var to jQuery Ajax call with two different file
- Unable to display multiple parameters from url by javascript through shortcodes
- Cannot find the php_ini configuration file to find my error log to see why my code is not working
- Adding HTML Code to Replace Text in PHP
- Gutenberg block don’t save rich text content
- Custom global variable not working in function
- Best way to use variables in multiple functions?
- Update $wpdb query with AJAX
- Using Javascript On Page – Header and Footer Now Missing
- How do I fix Undefined variable using $_POST in function?
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- How do I make comment-reply-button with that takes to comment reply form on click
- custom post type column countdown
- How to call a function from functions.php with ajax?
- Custom Post type Ajax search results
- WordPress load javascript file if something… (after the page is loaded)
- Automatically refresh page if widget is added to page?
- wordpress all post filter by year
- Find the method which AJAX GET calls
- Display text of price (minus 20%) on every product page in a sentence.
- Pulling a variable into the wp_nav_menu function
- Where can I find the declaration of `$_wp_theme_features`?
- Help with my first Metabox helper class
- Trouble figuring out how to get my button to submit comment
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- Import and use a variable in additional settings of Contact Form 7 [closed]
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- Show Login Errors In WordPress/Elementor (Code “works”, but breaks site)
- hiddenQuestions.find is not a function
- change title of page dynamically
- Calling a function via a shortcode in javascript
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- How to access admin menu labels and links on front-end?
- How to get default variation ID (woocommerce)
- Get check box values inside array for use in posting form data
- I want change custom title in custom wordpress php page
- Hide or Show Read More Button by Content Area
- Pass media upload value to input field
- Remove class that has been added by parent theme
- Create Logout Link WordPress Admin Menu
- Ajax – Call to undefined function get_option()
- How to pass Select value from Javascript to PHP to generate select option on change
- Content filter won’t work
- Get related product based on subcategory selected from category id with ID 142
- Fetching Initials of the Commentator in the WordPress Website
- Missing a text-domain esc_attr_e
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- All categories options or All categories not Populating
- Add class for the_post_thumbnail_caption()
- Undefined variable & issue with smof_data
- Adding ID to a Listing but not inside WP_Query while
- WordPress display name string manipulation
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- Require Credits Footer
- Undefined variable notice [closed]
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- bloginfo url in javascript
- How can I display a Divi content inside a modal based on an AJAX request
