@@ -786,7 +786,7 @@ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) {
786786
787787 $ label = esc_html ( sanitize_term_field ( 'name ' , $ t ->name , $ t ->term_id , $ taxonomy , 'display ' ) );
788788
789- $ term_links [] = get_edit_link ( $ posts_in_term_qv , $ label );
789+ $ term_links [] = get_edit_link ( $ posts_in_term_qv , $ label, '' , true );
790790 }
791791
792792 /**
@@ -816,13 +816,14 @@ function generate_taxonomy_links( $taxonomy, $post, $terms = [] ) {
816816 *
817817 * @since 2.0.5
818818 *
819- * @param string[] $args Associative array of URL parameters for the link.
820- * @param string $link_text Link text.
821- * @param string $css_class Optional. Class attribute. Default empty string.
819+ * @param string[] $args Associative array of URL parameters for the link.
820+ * @param string $link_text Link text.
821+ * @param string $css_class Optional. Class attribute. Default empty string.
822+ * @param bool $should_open_in_new_tab Optional. Whether to open the link in a new tab. Default false.
822823 *
823824 * @return string The formatted link string.
824825 */
825- function get_edit_link ( $ args , $ link_text , $ css_class = '' ) {
826+ function get_edit_link ( $ args , $ link_text , $ css_class = '' , $ should_open_in_new_tab = false ) {
826827
827828 global $ connection_now ;
828829
@@ -842,6 +843,7 @@ function get_edit_link( $args, $link_text, $css_class = '' ) {
842843
843844 $ class_html = '' ;
844845 $ aria_current = '' ;
846+ $ target = '' ;
845847
846848 if ( ! empty ( $ css_class ) ) {
847849 $ class_html = sprintf (
@@ -854,11 +856,16 @@ function get_edit_link( $args, $link_text, $css_class = '' ) {
854856 }
855857 }
856858
859+ if ( $ should_open_in_new_tab ) {
860+ $ target = ' target="_blank" ' ;
861+ }
862+
857863 return sprintf (
858- '<a href="%s"%s%s>%s</a> ' ,
864+ '<a href="%s"%s%s%s >%s</a> ' ,
859865 esc_url ( $ url ),
860866 $ class_html ,
861867 $ aria_current ,
868+ $ target ,
862869 $ link_text
863870 );
864871}
0 commit comments