copy fields value to another field

You do not need to, instead add the user URL column to the list of searchable table columns https://developer.wordpress.org/reference/hooks/user_search_columns/ Which includes a user contributed example that does this: https://developer.wordpress.org/reference/hooks/user_search_columns/#comment-4605 add_filter( ‘user_search_columns’, ‘wpdocs_filter_function_name’, 10, 3 ); function wpdocs_filter_function_name( $search_columns, $search, $wp_user_query ) { $search_columns[] = ‘user_url’; return $search_columns; } With this, no syncing to a URL … Read more

Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?

ok – so this isn’t what I wanted but it does the trick. Adding a function to redirect when the user hits any term but one: function my_page_template_redirect() { if( is_singular( ‘custom-post-type’ ) && !(has_term(‘term’, ‘custom-taxonomy’)) ) { wp_redirect( home_url(), 301 ); exit(); } } add_action( ‘template_redirect’, ‘my_page_template_redirect’ ); Answer based on this one: Disable … Read more

Change category display name function

So I wonder why don’t you just set the category title via the admin page, e.g. for the one having the slug alphabetical, you could set All Characters as a static title for the category? That way, you wouldn’t need to hook on get_the_archive_title.. But anyway, here is one way of how can you reduce … Read more

How to put the author of the post in the comments?

Not sure it’s the shortest way, but it works) Get post author id $post_author_id = get_post_field( ‘post_author’, $c->comment_post_ID ); Get author data by id $post_author_display_name = get_the_author_meta( ‘display_name’, $post_author_id ); Try this shorter version $output.= get_the_author_meta( ‘display_name’, get_post_field( ‘post_author’, $c->comment_post_ID ) ); Check documentation page which data is available with get_the_author_meta()

Which filter fires upon setting a featured image

A nearly identical use case for your question is found in the WordPress documentation for the filter admin_post_thumbnail_html. A filter hooked to this will receive the HTML for the admin screen as $content. Modify and return this markup as you wish. function filter_featured_image_admin_text( $content, $post_id, $thumbnail_id ){ $help_text=”<p>” . __( ‘Please use an image that … Read more

Display Script in Header When URL Variable Present

URL variables like that are stored in the $_GET variable. You can check the existence and value of one like this: add_action( ‘wp_head’, function() { if ( isset( $_GET[‘feedback’] ) && ‘yes’ === $_GET[‘feedback’] ) { ?> <script> alert( ‘Hello, world!’ ); </script> <?php } } ); The check for isset() is necessary as checking … Read more