Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • bbottema

    (@bbottema)

    I’m having problems along these lines as well, now.

    I have wordpress 4.4.2 and Folders 1.3.3 installed.

    There are two issues with this. I’m using folders on Attachments only:

    1). When I go to “Media Folders” the count remains 0, but when I click on it, the correct items are shown for that specific folder.
    2). The Folder icon is missing in the menu.

    1 and 2 are probably related in that it’s counting the items inside the folder incorrectly. It counts 0 items, so the Folders item doesn’t appear in the menu and it shows 0 in the “Media Folders” page.

    I think I need auth as well, considering I have no way of logging in otherwise (it’s a full javascript project). I guess I could fake a slab of html, hide it and use that, but that is very ugly (and very 2003, a reminiscence of faking Ajax-like behavior with iframes)

    First you need a nonce (Number used ONCE), which is a temporary key you’ll use to be able to invoke the API with:

    https://yourblog.com/?json=core.get_nonce&controller=posts&method=create_post&callback=?

    This gives you a nonce number (be sure to use &callback=? as it marks the content as jsonp, or you’ll get a similar -but invalid- nonce).

    Then use this nonce to create a post:

    https://yourblog.com/?json=posts.create_post&nonce='+nonce+'&title='+title+'&content='+content+'&status=publish (or draft, or leave it out altogether)

    Make sure you have the ‘posts’ controller enabled in your wordpress plugin JSon API settings. Check this manual for what JSon data structures you can expect back from these calls.

    Now, here’s the tricky part: you need to be already logged into the wordpress site, because with this JSon API, you can’t log in. I haven’t figured that part out yet, so I’m still looking for a good solution myself. I tried manually posting and also width ajax but with limited results considering I’m missing a WordPress test cookie in my headers (at least this is the main difference I see when logging in from the site and doing it manually)

Viewing 3 replies - 1 through 3 (of 3 total)