Read Our Reviews

Bold City Agency is rated 5 out of 5.0 stars based on 28 review(s).

---

We were very pleased with the new design that Bold City created for our website. Modern, sleek and our visitors seem to love it. Excellent communication throughout the entire process. A+

- Mary Soulette

---

We are so pleased with the support and help with our website that Bold City has provided. Keep up the great work guys and gals!

- Mary Watson

---

Great team to work with. Remarkably fast to respond to emails and requests, much better than the last company we were working with.

- Steve Lawton

---

Awesome work. Quick to respond to requests and very knowledgable. Transfer over to Bold City was painless and they handled everything.

- Donald Herena

---

Great company to do business with. Honest and fair with pricing. Our requests were small, needed some assistance with configuring email services but Bold City diagnosed the issues quickly and completed the work on time. We will be back for future help.

- John McAlpin

---

Cabe & team, we love you guys!  Keep up the great work.

- Marcus Yoker

---

It’s so difficult to find a technology contact that understands time is money.  We’ve gone through a few that did good work when you could get them on the phone but that was a rarity.  We would go 1+ weeks and not even get a response.  This was costing our business literally thousands of dollars due to issues with our website and email.  Bold City has been nothing but a blessing.  They return my calls and emails promptly and thus far (fingers crossed) have always met their promised deadlines.  If you’re looking for a company that understands the importance of communicating with their clients, you’ve found the one.  They have my recommendation.

- Abby Timmons

---

Who ya gonna call?! BOLD CITY! But seriously, nothing but a pleasure to work with.  We trust them completely and they have our business for life.

- Lona Mayer

---

Best website design company out there. USE. THESE. GUYS.  Affordable, fair, great communication and great work.

- Susan Johnson

---

As a technology company we know great work when we see it.  We had an internal learning system that was built by a previous employee.  When that employee moved on from the company we had nobody internal that understood WordPress enough to make changes and continue to improve the system.  We outsourced the project to Bold City, they took it head on and we’re able to make our required changes.  We plan to use them more in 2019.

- Mike Dawker

---

Bold City built us a fantastic website the showed off our company perfectly.  They recommended fantastic additions including the video on the homepage which really sets our site apart from anybody else.  We get soooo many compliments on our website and the new patients we’ve brought in have been fantastic.  Great work guys!

- Brittany Higgins

---

Great work as always!  We’ll be back when we need additional help.

- Jenny Walker

---

Cabe & team are awesome at what they do.  Fast, reliable and most importantly communication is A+.  Finding people that are able to communicate what they are doing and regularly hit promised deadlines is a rarity these days but Bold City delivers!

- David Ayers

---

Best WordPress designers out there!  If you’re on the fence about hiring them, jump off!  You’ve found the best company out there!

- Samantha Lloyd

---

I’m not a very tech savvy person so I wanted to find a web design company that could take my vision, turn it into a reality and handle the management.  Bold City has been terrific and I always know my website is working in the background.

- Jannis Darring

---

We’ve been working with Bold City for over 5 years and never have had a bad experience.  Quick and reliable, A+.

- Jane Walton

---

After extensive research, we hired Bold City to handle the re-design of our 10+ year old e-commerce website.  Bold City took every challenge we threw at them head on.  Going above and beyond just design, they assisted with payment processors, shipping and made several recommendations that have improved our bottom line.  Their in-depth knowledge has been  major reason for our continued success.

- Jonathan Vemus

---

Awesome, awesome, awesome!  Fast, reliable and very cost effective for our business.  Bold City took over our website from our previous designer who was retiring and the transfer process was seamless.

- Jennifer Handler

---

These guys were awesome.  We contacted them to move hosting providers as we were struggling with communication with our current host.  They transferred our site same day at no cost.  Cabe was terrific to work with and has been very easy to get in touch with since.

- Mark Gosling

---

You know how they say “you can’t havw FAST CHEAP AND QUALITY?” Well, you CAN with Bold City Agency. They do BEAUTIFUL work, in a timely manner AT A FAIR price! Couldn’t ask for a better agency!

- DJ / Lindsey

---

Great work!  The marketing results they delivered were fantastic and for once, 'made sense'.  I can't tell you how many times we've been told one thing and received something completely different.  Finally we have measurable results.

- Josh Utilis

---

Prompt accurate service

- Denny Dotson

---

Bold City is great. Super responsive and wonderful attention to detail. Highly recommend.

- Gwinn Volen

---

Awesome work!  Very responsive to emails and phone calls and delivers on promises.

- Mark Aston

---

Cabe and Bold City do great work! They do a great job helping our law firm with our website and online needs.

- John Ginn

---

Cabe was great to work with on my website design. Easy to talk to, he understood my vision/goals, great turnaround time, and able to reach easily. Thanks for a website that I love!

- Denise Maniakouras

---

Awesome stuff!  I love working with Bold City.

- Megan Donaldson

---

Highly recommend! Delivers on promises.

- Brittany Will

WordPress REST API – Creating A Post With Post Meta (Custom Fields)

Jun 01, 2018

WordPress REST API – Creating A Post With Post Meta (Custom Fields)


This post was originally created on our sister site WP Cover.
View Original Article
June 1, 2018

A business venture of mine has been evolving and as a result, I’m excited to get my first in-depth, real-world exposure to the WP REST API.  For the most part, I know my way around as I took a day or two back when it was all the talk to learn the basics but I’ve never had a good real-world opportunity come up to use it until recently.

Without getting to in-depth on the specific project, the main goal is to securely create a post (as a custom post type) and also create a new user.  We’ll also be updating custom fields for both the post and the user.  These custom fields will have already been created using Advanced Custom Fields.

Setting The Stage:

For this tutorial, I’m going to assume that Site A & Site B are both WordPress sites.  Site A is where I will want to connect to the REST API.  Site B will be where the remote call will be coming from.

On Site A, I’m going to install a plugin from the WordPress repository called Application Passwords.  It will handle our authentication.  Application Passwords is a step above basic username/password authentication but below Oauth.  It will work for this project since there will only be one, consistent source that will be sending requests to the API.  Application Passwords is also very simple to setup and work with.

 

On Site B, I’m going to install my handy WP Cover ‘Do Random Stuff’ Plugin.  You don’t have to if you prefer to setup the test environment a different way but this plugin just creates a simple canvas to construct my API calls to Site A.

Gathering Credentials

Next, it’s time to gather my authorization credentials.  Head over to Site A and activate the Application Passwords plugin if you did not do so already.  Head over to Users and edit or create a new Editor user.

Side note, for my specific project I did not want to give full admin capabilities to the user connecting over the API.  This is why I’ve utilized an Editor.  For your project, you may be fine with using an Admin role instead.  Up to you.

On the Edit User screen for the user you have selected, scroll to the bottom and generate a new Application Password.  A popup will show your application password.  Make sure you save it as it will never be shown again.

 

Constructing the Call

We’re ready to head over to site B and construct our API call.  We’ll go edit our ‘Do Random Stuff” plugin with the below code (I’ll explain it in a minute):




Do Stuff

Click Process button to do whatever is below in your run process. array( 'Authorization' => 'Basic ' . base64_encode( 'USERNAME:APPLICATION_PASSWORD' ) ), 'body' => array( 'title' => 'WP Cover Test Post', 'status' => 'draft', 'content' => 'this is the main content box', 'meta' => array('field-symbol' => 'CNENT', 'field-description' => 'I get it') ) ) ); $body = json_decode( $api_response['body'] ); if( wp_remote_retrieve_response_message( $api_response ) === 'Created' ) { echo 'The post ' . $body->title->rendered . ' has been created successfully'; } } ?>

The first value you will want to change will be the wp_remote_post URL. Obviously replace YOURWEBSITE with the correct URL to Site A.  Also, the very last value of /dogs should correctly correspond to your custom post type.  Secondly, you’ll need to adjust the USERNAME and APPLICATION_PASSWORD to the WordPress username and application password you generated in the earlier step.

Your API call is almost ready to go!  Go ahead and adjust the post data inputs as you see the need until we get to the last value of Meta.  Meta will be your custom fields and as I mentioned earlier, I’ve already created these custom fields on Site A using Advanced Custom Fields.  The meta values are delivered in an array as seen in the above code example.

Before our meta values will successfully populate into the post, we have to add another function.  Head back over to Site A and open up the functions.php file on your active theme and add in the following:

add_action("rest_insert_dogs", function (WP_Post $post, $request, $creating) {
    $metas = $request->get_param("meta");
    if (is_array($metas)) {
        foreach ($metas as $name => $value) {
            update_post_meta($post->ID, $name, $value);
        }
    }
}, 10, 3);

On the first line, change the action of rest_insert_dogs to your custom post type. So if your post type was cats, your action would be rest_insert_cats.

Save the file.

Ready to Go

You’re ready to test out your API call.  Press the Process Posts button the Do Random Stuff plugin page on Site B and see what happens!  If all went to plan, you should be returned a value of:

The post (Insert Post Name) has been created successfully.

Of course you’ll want to check on Site A to be sure everything went smoothly.

I’ll be back next week to discuss the API call to add a new user and we’ll also combine both of these calls to effectively add a new post created by this new author.

The post WordPress REST API – Creating A Post With Post Meta (Custom Fields) appeared first on WP Cover.

Additional News

Perfect!

Let's get started. Fill out the form below to email us or request a call back.