Run a WP-CLI command as a given WordPress user
Use the –user=
Use the –user=
Generate a professional WordPress Privacy Policy, terms of use, terms & conditions, eCommerce returns & refunds policy, affiliate disclaimers & more. Covers 25+ expert vetted legal pages for WordPress websites.
So how do you set cookies in WordPress? With core constants:
COOKIEPATH — Server path in which the cookie will be available on.
COOKIE_DOMAIN — The (sub)domain that the cookie is available to.
Setting cookies in WordPress, especially the expiration is a cinch using one of the core time constants, available since v3.5:
MINUTE_IN_SECONDS = 60 seconds
HOUR_IN_SECONDS = 3,600 seconds
DAY_IN_SECONDS = 86,400 seconds
WEEK_IN_SECONDS = 604,800 seconds
MONTH_IN_SECONDS = 2,629,746 seconds
YEAR_IN_SECONDS = 31,556,952 seconds
Don’t forget to add the current timestamp to one of these constants, for example:
// 5 minutes into the future
$five_minutes = current_time( ‘timestamp’ ) + ( MINUTE_IN_SECONDS * 5 );
In the first parts we focus on the basics. We set up a development environment with running compilation of our code. And the basics of how to register a block and the necessary PHP parts of it as well. We’ll learn about the huge library of components and methods available to us from WordPress Gutenberg.
Moving on we’ll learn about how to add sections and settings for our block in the editor sidebar (Inspector) as well as customizing the toolbar. Along the way we’ll touch a lot of different input types and how to use Gutenberg’s component for these. And of course we’ll learn how to save, update and output the saved information to our block – and how that works behind the scenes.
At the end we’ll look at more advanced things like dynamic blocks and how to use PHP to render the block output. And finally how to make post queries inside the editor – allowing the user to select a post from a list for render.
Say you want to intercept a response from any WordPress API call before it gets returned to the user? For example, you want to block /users/ route or append additional content to a /posts/ response. Simply call the rest_pre_echo_response filter and you can modify all responses!
Adds value `lang` and `translations` to WP REST api response for each Post and Page request for site running the Polylang Pro plugin.
Adds polylang_translations and keeps lang to WP REST api response for each Post and Page request for site running the Polylang Pro plugin.
SlotFill is a modernized take on classic interface “hooks and filters”—a convention for empowering developers to extend the publishing interface outside of the block editor itself—that found its way into WordPress.
The easiest way to achieve this, is to consider the gallery as a Dynamic block and re-declare its render through PHP:
Extensibility is key, and we can’t build the next generation of the WordPress Editor without making it extensible. What does “making it extensible” mean? Does this mean providing hooks and filters in JavaScript the same way we do in PHP? Does this mean allowing plugins to extend and tweak any UI component used by Gutenberg? Does this mean adding filters to the REST API? Does this mean Giving access to an Editor object to manipulate the editor’s content?
There’s no clear answer to all these questions. Extensibility is a very difficult problem and unless you build it with real use-cases in mind, you’re more likely to get it wrong. (and being stuck with it for a long time).
apply_filters($tag, $value) passes the ‘value’ argument to each of the functions ‘hooked’ (using add_filter) into the specified filter ‘tag’. Each function performs some processing on the value and returns a modified value to be passed to the next function in the sequence.
Adding a new field with the register_api_field function
The described below requires more code, but it’s more elegant and opens up many more possibilities for expanding our functionality.
It is a theme feature which helps us to control our content width for images, videos and embeds. If you used _s starter theme or browsed through any official WordPress theme, you saw it in the functions.php. In today’s responsive design, it is not the most necessary tool for the images but still useful because of the other media formats.
The Customizer Export/Import plugin allows you to export or import your WordPress customizer settings from directly within the customizer interface! If your theme makes use of the WordPress customizer for its settings, this plugin is for you!
This tutorial explains how to create new files and directories in the WordPress /uploads/ folder.
Decisions not Options
When making decisions, these are the users we consider first. A great example of this consideration is software options. Every time you give a user an option, you are asking them to make a decision. When a user doesn’t care or understand the option, this ultimately leads to frustration. As developers, we sometimes feel that providing options for everything is a good thing, you can never have too many choices, right? Ultimately these choices end up being technical ones, choices that the average end user has no interest in. It’s our duty as developers to make smart design decisions, and avoid putting the weight of technical choices on our end users.
Distributor is a WordPress plugin that makes it easy to syndicate and reuse content across your websites — whether in a single multisite or across the web.
The WordPress Foundation owns and oversees the trademarks for the WordPress and WordCamp names and logos. We have developed this trademark usage policy with the following goals in mind:
We’d like to make it easy for anyone to use the WordPress or WordCamp name or logo for community-oriented efforts that help spread and improve WordPress.
We’d like to make it clear how WordPress-related businesses and projects can (and cannot) use the WordPress or WordCamp name and logo.
We’d like to make it hard for anyone to use the WordPress or WordCamp name and logo to unfairly profit from, trick or confuse people who are looking for official WordPress or WordCamp resources.
Download an image from the specified URL and attach it to a post.
media_sideload_image($file, $post_id, $desc, $return);
I suggest that you use $query->set( ‘lang’, ” ); in a function hooked to parse_query with priority 1.
The WP Engine PHP Compatibility Checker can be used by any WordPress website on any web host to check PHP version compatibility.
WP Migrate DB exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, handles serialized data, then allows you to save it to your computer as an SQL file.

Delivering WordPress in 7KB 6KB*
This website aims to act as a guide to making WordPress websites more sustainable, and to serve as a practical example of how we can tune our websites and reduce their carbon footprint. The homepage of this website is delivered to your browser with just 6KB of data transfer. This is achieved by its theme, plugins and configuration. As of 2016, the average website data transfer was 2.3MB, making it 393 times bigger than this website!
them.es Starter is a WordPress Starter Theme built with Bootstrap.
…the ability to create and use custom taxonomies has been around since 2007. We didn’t get all the cool functions added until 2.8 though.
However, one thing we’ve had since 2.3 was the ability to create taxonomies for any object type, not just posts. In WordPress, there are several object types:
Posts
Users
Comments
Links
So, you can technically create a taxonomy for any object type. Most of WordPress core support is for posts, but the API is extremely well thought out and can handle the other object types with minimal code effort.
This tutorial will focus on registering and using a taxonomy on the user object type. It will not be a 100% solution for everything you can do with a custom user taxonomy. Consider this an extremely rough draft of what’s possible.
TypeRocket is like Advanced Custom Fields + Laravel + Magic in WordPress for FREE.
At GPLDL we felt that releasing “Premium WordPress Plugins” and “Premium WordPress Themes” only to people who purchase support licenses constrains the dissemination of GPL-licensed software. So we decided to break up these expensive packages by providing the exact code available from the developers for download at GPLDL.
That’s why we set up GPLDL as a club – legally sharing hundreds of Premium GPL-licensed WordPress items with our members. That gives all of our members access to the code they actually need by removing the developer’s support they are otherwise forced to pay for.
The GPL licence, which is the foundation of WordPress and all plugins in the WordPress repository, is a great license, no doubt. It has permitted WordPress to become what it is today, and have such a wonderful community form around it.
I’m lately seeing a small surge in the number of people who are taking advantage of the GPL in what many consider an unethical way. I’m talking about the WordPress plugin stores that are cropping up and selling plugins developed by other people.
Clean up your WordPress website’s HTTPS insecure content and mixed content warnings. Installing the SSL Insecure Content Fixer plugin will solve most insecure content warnings with little or no effort. The remainder can be diagnosed with a few simple tools.
Clearly a project the size of WordPress needs some strong leadership and a clear roadmap. However, when that roadmap starts to be clouded by outside factors such as financial pressure to compete with the market, decisions aren’t made in the best interest of everyone. Don’t forget that whatever is implemented in WordPress.org is being built for WordPress.com (one of the main money-making arms of Automattic) and no doubt their biggest concern when considering losing customers to competitors. Gutenberg is a clear attempt to attract new users to the platform.
The major part of backwards compatibility is not breaking things, or doing everything possible to avoid it. Gutenberg simply will break sites. This won’t be white screening, or breaking appearance on the frontend, but as soon as a site is updated to 5.0, a user will have a broken experience the next time they edit a post, if the site relies on custom meta boxes.
The percentage number of sites on the web that are powered by WordPress is often touted and this number will be made up of a variety of different types of sites and site owners. A large number will be developers, freelancers and agencies who have built sites in the past, manage sites currently, and build every new site with WordPress. From experience, these developers typically don’t use page builder plugins but a combination of custom fields and meta boxes to give clients the ability to add all the data needed to be displayed on the site in a controlled and prescribed style.
These people will need to prepare for 5.0 (more on that later) to make sure their clients aren’t affected by Gutenberg.
Out of all the modern frontend frameworks, React was always the first choice for Gutenberg, even after some token debate, and weathering the storm of patent clauses. But adding a shiny new framework to a critical piece of WordPress core is highly problematic and we’ve seen it before. WordPress 3.5 was released with a new media manager, built with Backbone and landed without documentation, no clear extensibility model, and a steep learning curve for core contributors and developers with media-related plugins.
Gutenberg has the potential to go the same way, but undoubtedly it will reduce the amount of people able to contribute to it, without learning React deeply. It also places a burden on plugin developers (in a short timescale) to learn, adapt, and get their plugins ready.
Of course this is possible for the big guys like WooCommerce (Automattic owned, large team) and Advanced Custom Fields (independant small team, huge user base), but this will affect any plugin which registers a custom post type, or meta boxes. Most developers simply won’t have the time, inclination or skills to make them compatible with Gutenberg. We will likely see a lot of plugins broken which just won’t get fixed. That will have a detrimental effect on user experience and the WordPress ecosystem in general.
Core should leave Gutenberg as a feature plugin for longer. The timeline is just too short for people to prepare. It is too great a change to be rushed. I think the decision to be merged should be rethought and only merged when a certain level of plugin adoption by users is reached.
I think the best way is to use WP-CLI but you’d need to write a bash script to do this.
UnderStrap combines the Underscores starter theme (by Automattic) and the mobil-first, responsive grid framework Bootstrap 4 (by Twitter) into a perfect open source foundation for your next WordPress theme project.
…several Conditional tags available for Pods Templates to make it easier to create the output you’re looking for in your Pods Templates.
Object-oriented code, among other things, can help organize and add reusability to your code. In this tutorial, I will teach you the basics of writing a WordPress plugin using object oriented techniques.
403 Forbidden error code is shown when your server permissions don’t allow access to a specific page.
There’s a free q-translate to WPML migration plugin. Install it and run it. And there’s a WPML to polylang migration plugin…
Ah interesting. I presume I don’t need WPML installed for that trajectory?
Correct, just the migration plugins.