WordPress.org

Ready to get started?Download WordPress

Forums

Admin bar icons and wp_insert_attachment (4 posts)

  1. sqhendricks
    Member
    Posted 7 months ago #

    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.

  2. sqhendricks
    Member
    Posted 7 months ago #

    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".

  3. sqhendricks
    Member
    Posted 7 months ago #

    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.

  4. bcworkz
    Member
    Posted 7 months ago #

    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.

Reply

You must log in to post.

About this Topic