So I am trying to replace the original post_title with a custom field right of the same post after saving the changes. However, I am getting the following error on the post page:
Warning: Missing argument 2 for wpse33385_filter_title() in $PATH/public_html/wp-content/themes/$THEME/functions.php on line 113
// replaces the original post_title with the value of pac-short-title
add_filter( 'the_title', 'wpse33385_filter_title', 10, 2);
function wpse33385_filter_title( $title, $post_id )
if( $new_title = types_get_field_meta_value( 'pac-short-title', $post_id ) )
This warning may be caused by the post id not being set in some instances of the usage of this filter in some versions of WordPress.
The solution is to set a default value for the post id.
function wpse33385_filter_title( $title, $post_id = null )