0

How do I set default values for the edit_post_link function in my theme?

I'd like to change the 'Edit This' string to a custom value, but specify this only once, so I can use instead of everywhere.

Is this even possible?

1

You can write your own hook for edit_post_link filter:

add_filter( 'edit_post_link', 'wpse8170_edit_post_link' );
function wpse8170_edit_post_link( $link ) {
    $matches = array();
    if ( !preg_match( '/\>.*?\<\/a\>/i', $link, $matches ) ) {
        return $link;
    }
    return str_replace( $matches[0], '>MY NEW EDIT LINK TEXT HERE</a>', $link );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.