New answers tagged

0 votes

How to allow Unfiltered HTML in a wordpress multisite install

I found this code to work for me function multisite_restore_unfiltered_html( $caps, $cap, $user_id, ...$args ) { if ( 'unfiltered_html' === $cap && (user_can( $user_id, 'editor' ) || ...
user avatar
0 votes

Filter nav menu items HTML tags and wrap inner text with span

Here is my solution with assistance from TheDeadMedic. I added the <svg> code to the replacement value in the preg_replace function, then added the opening and closing <span> tags to the ...
user avatar
1 vote

Filter nav menu items HTML tags and wrap inner text with span

Just use link_before in your wp_nav_menu $args and add opening/closing span tags: $args = [ 'link_before' => '<span>', /* Add closing </span> to link_after */ 'link_after' =&...
user avatar
  • 35.5k
1 vote

How to add nonce tag to inline script for CSP

You can use the script_loader_tag filter: function wpse_406351_script_tag_nonce( $tag, $handle ) { if ( $handle === 'id_of_script' /* handle used in wp_enqueue_script/wp_register_script */ ) { ...
user avatar
  • 35.5k
0 votes
Accepted

How do I add <div> tags to entire comments, not just their text

Currently your comment markup looks similar to the following: <li class="comment byuser comment-author-rcotwunite odd alt thread-odd thread-alt depth-1" id="comment-7902"> &...
user avatar
  • 5,340
1 vote
Accepted

How to replace username with email address in users table

It seems that the username column content is hardcoded in single_row() of WP_Users_List_Table and there isn't a filter you can use to change it. A hacky way is to enqueue some javascript on the users ...
user avatar
0 votes

How to replace username with email address in users table

function wpse406344_replace_usernames() { //Get all the users $users = get_users(); //Loop through them and update user_login table foreach( $users as $user ) { ...
user avatar
  • 2,680

Top 50 recent answers are included