This topic contains 1 reply, has 2 voices, and was last updated by  Steve 1 week, 1 day ago.

  • Author
    Posts
  • #9340

    mikakoo
    Participant

    Hello,
    To workaround an issue I am redirecting the user back to the normal view of a CPT after they submit changes to it via FEF.

    I have achieved this using the piklist_request_field filter, but wonder what other ways the community might suggest this could be done more efficiently.
    It also relies on the Redirect: comment block directive – if this is removed, my code doesn’t get called.

    Here’s my code:

    //
    //	Alter the Redirect link for Edit Listing form
    //
    add_filter( 'piklist_request_field', 'thearr_request_field' );
    function thearr_request_field( $field )
    {
            // only interested in the redirect field
    	if ( strcmp('redirect', $field['field']) === 0 )
    	{
                    // this is what tells the FEF which data to use
    		if ( isset( $_REQUEST['_post']['ID'] ) )
    		{
    			// change redirection back to the normal view after edit
    			$field['value'] = get_permalink( $_REQUEST['_post']['ID'] );
    		}
    	}
    
    	return $field;
    }

    Thanks for any help.

  • #9353

    Steve
    Keymaster

    I think this is the correct way. Looks good to me.

You must be logged in to reply to this topic.