How to Get Featured Image from REST API?

I am trying to get the featured image of a post using the WordPress REST API. I am adding the extention of ?embed to the end if the REST API url and I am seeing the featured image data under [‘wp:featuredmedia’], but I can’t seem to display that data. I am using Vue to display data from the REST API and so what I am doing currently to try and get the featured image source is: post._embedded[‘wp:featuredmedia’][0].source_url But by doing that it can’t find the source url of the featured…

wordpress editor role remove all but ‘menus’ in appearance menu

I’m trying to remove access to everything in the appearance menu in WP admin for the role editor. Or at the least, just remove access to themes and plugins. I have found how to remove the whole appearance menu but not parts of it like that. is this possible? Preferably something in functions.php so I could toggle this on/off if ever I needed. Source: https://wordpress.stackexchange.com/feeds

How to use current_user_can() in register_rest_route()?

I’m trying to assert current_user_can() in the permission_callback method of a register_rest_route function. However, it always returns false. Upon further debugging, I see that wp_get_current_user() function returns ID zero, which probably means the $current_user global isn’t available at the moment of execution. That means this example from the documentation shouldn’t work: <?php add_action( ‘rest_api_init’, function () { register_rest_route( ‘myplugin/v1’, ‘/author/(?P<id>d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘my_awesome_func’, ‘args’ => array( ‘id’ => array( ‘validate_callback’ => ‘is_numeric’ ), ), ‘permission_callback’ => function () { return current_user_can( ‘edit_others_posts’ ); } ) );…

ITCSS × Skillshare

Back in February 2018, Scott Sullivan, Partnerships Team Lead at Skillshare, sent me an email asking if I’d be interested in collaborating on an official ITCSS video course in conjunction with them. Sign up and learn ITCSS today! The email was extremely well timed. ITCSS is a mature and very successful piece of work of which I am very proud, but with my recent move to focussing more on front-end performance, I was keen to set ITCSS a little more free: I wanted to liberate the content and make it…

WordPress database error Duplicate entry for key ‘slug’

I have just migrated to a new host and upgraded my WordPress to 4.9.8 (from 3.9.x, embarrassing I know, plan to keep it up to date from now on). I also went through the process of replacing plugins that were not maintained and updating everything. Once I was done, I exported my PHP logs to make sure that everything was running smoothly and I found this error message being spammed (hundreds of lines per day): [24-Nov-2018 06:25:10 UTC] WordPress database error Duplicate entry ‘gaming-laptops’ for key ‘slug’ for query INSERT…

What If?

I was recently conducting some exploratory work for a potential client when I hit upon a pretty severe flaw in a design decision they’d made: They’d built a responsive image lazyloader in JavaScript which, by design, worked by: immediately applying display: none; to the <body>; waiting until the very last of the page’s images had arrived; once they’d arrived, removing the display: none; and gradually fading the page into visibility. Not only does this strike me as an unusual design decision—setting out to build a lazyloader and then having it…

How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option

I’m having troubles with the mysqli driver used by wordpress, where it is converting each and every integer value to a string within $wpdb->get_results(« SELECT… »). I know that it is possible so use the the option MYSQLI_OPT_INT_AND_FLOAT_NATIVE with the mysqli driver ($mysqli->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);) but I don’t seem to find a way to set this option in wordpress. How do I do that? Thank you EDIT Based on the comments below, I’b better further explain what I’m trying to achieve. I’m developing a plugin to add reactive/responsive functionalities to wordpress both in…

Syncing production with staging

we have a staging server in order to test out plugins and roll out new features and also re designing sites. The issue is that the staging version of the site will be out of sync as soon as new content is done on live site, or a new image is uploaded. What is the best way to keep the staging version in sync with the live one, including all posts, images and plugins as well as the whole database in general. Source: https://wordpress.stackexchange.com/feeds

Replace text string on individual page

I am looking to replace a few text strings for only two specific pages on a wordpress site. It should not affect those strings on any other pages. I’d prefer to do this via adding some code to functions.php I think using part of this code would be the first part, just need help with the rest https://wordpress.stackexchange.com/a/278357 Source: https://wordpress.stackexchange.com/feeds

Web Design Weekly #339

Headlines Web Dev A greate resource for developers of all backgrounds to learn, create, and solve on the web. It’s meant to not only educate developers, but help them apply what they’ve learned to any site they work on, be it personal or business. (web.dev) Designing, laws, and attitudes (ethanmarcotte.com) Sponsor Web Design Weekly and reach over 30,162 passionate designers and developers Articles CSS and Network Performance Harry Roberts does a rather large brain dump of all things relating to CSS and performance. A great read for all abilities. (csswizardry.com)…