Support » Plugins » Hacks » Admin bar icons and wp_insert_attachment

  • I have a function that runs after a form is submitted that creates an attachment to a post. However, after the form is submitted, the admin bar icons are replaced either by empty squares or odd characters. I have narrowed this down to the call to wp_insert_attachment.

    When that fires off, and the page refreshes, the icons are garbled. If I go to another page, or reload the page, they’re ok, but this is a bit disconcerting.

    Any ideas why this might be happening? I’ll be glad to provide some code, if that would help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Further data: it seems that it also happens if I use media_handle_sideload to move an uploaded file to the uploads directory, which also seems to create the attachment, using “wp_insert_attachment”.

    Ok, I may have been able to hack a solution to this, by re-registering the dashicons css file after calling wp_insert_attachment. That seems to allow the dashicons to show up again after file submission. However, I wonder if this might be a larger problem.

    Moderator bcworkz


    Kind of sounds like a connectivity issue. The dashicons.css file should be loaded on any page with the admin bar or menu. The upload and side load processes have nothing to do with CSS other than tying up the server and HTTP connection briefly.

    AFAIK, the only other problems reported so far with dashicons have been related to browser configuration issues, such as not allowing pages to use their own fonts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Admin bar icons and wp_insert_attachment’ is closed to new replies.