Is there a list / reference for all current native WordPress blocks?

I'm working on a theme that should style all native WordPress blocks via CSS, including potentially extending them with custom 'style' options in the block editor via JS. Does anyone know of a list or reference site which lists all native blocks, ideally including information on the WordPress version(s) where they were introduced and links to their registerBlockStyle 'names' (ie, core/button or core/buttons)? Searching in the Codex, Handbook and in Google isn't getting me anywhere so far. Obviously I can …
Category: Web

Javascript WP Object Documentation?

I was working on implementing the media library within one of my plugins/themes. I found a nice tutorial (http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in-plugins/) that showed me how to do this using the JS object 'wp' I can't seem to find any documentation on this in the codex or when Googling. How does one learn this object and its methods?
Category: Web

PHPStorm and CodeSniffer do not recognize WPCS

I'm trying to use Wordpress Coding Standards in my PHP Storm projects but I keep getting errors. What I already did: I put it in composer.json: "require": { "squizlabs/php_codesniffer" : "3.*", "wp-coding-standards/wpcs": "2.3.0" } I configured CodeSniffer in the QualityTools option In Inspections -> PHP -> QualityTools, I put Wordpress in Coding Standard. The problem: Even though I've done all this, I'm still not able to evaluate the codes from WPCS. The following error is returned: ERROR: The file "standard=WordPress" …
Category: Web

Is there widely accepted phpDoc syntax for documenting which hook calls a function?

I keep all hooks in one file, and the functions are organized in their respective classes (different auto-loaded files). Looking for a standard way to document that a function's sole purpose is to be called on 'init' for example. Currently using @see 'init' Thanks! Example Code hooks.php add_action( 'init', 'remove_image_sizes' ); functions.php /** * Removes image sizes added by mistake prior to 1.6.18 * * @since 1.6.18 * @see 'init' * @return void */ function remove_image_sizes() { remove_image_size( 'foo' ); …
Category: Web

Is the default value of FORCE_SSL_ADMIN documented?

(Update. I rephrased the title since I understood better meanwhile what was going on.) Dealing with an attempt to understand HTTPS redirection, I ended up seeing with a massive grep -r 'FORCE_SSL_ADMIN' ./www, this piece of code in default-constant.php (Wordpress 5.7.2, line 328): function wp_ssl_constants() { /** * @since 2.6.0 */ if ( ! defined( 'FORCE_SSL_ADMIN' ) ) { if ( 'https' === parse_url( get_option( 'siteurl' ), PHP_URL_SCHEME ) ) { define( 'FORCE_SSL_ADMIN', true ); } else { define( 'FORCE_SSL_ADMIN', …
Category: Web

When should I use @see tag in my inline doc for Functions & Class Methods?

The coding standards state to use @see for "Reference to a function, method, or class that is heavily-relied on within." Ok. But if I have a function, it always means that something uses it, because there's no need to write a function if it is not used. And what does "heavily-relied" mean? It means if I'll remove a function, the dependent function won't work correctly? Still every function, and still I should always use "@see" tag. If I look at …
Category: Web

Private pdf files

I would like to give access some private pdf files to only logged in users. I have this in my htaccess: RewriteCond %{REQUEST_FILENAME} ^.*(pdf)$ RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] RewriteRule . - [R=403,L] But I want to restrict access only documents .pdf with name starts with "private_". Example: private_document1.pdf and private_document2.pdf only have to be accessible by logged in users. Please, any ideas?
Category: Web

Callback hooked to post_updated firing on new posts as well

Context: I'm using a plugin that allows me to add author boxes throughout my site (Simple Author Box), while providing an easy way for any user to update their social media links and profile pictures. I figured I could also leverage that plugin to dynamically show the team members in the site's about section. However, I didn't want to have author archives for the team members that won't be publishing any posts in the future (designer, myself etc.), so I …
Category: Web

What are all the query parameters for getEntityRecords?

I'm working on a plugin that defined a custom block for the Gutenberg/Block Editor. The block shows a select box of posts. When you select one, I create HTML with some of the selected post's fields, such as title, date, etc. When I query my posts in the edit method, my code correctly produces a list of pages (in my case, a custom post type named product), but custom fields, which this post type has, are not included. var pages …
Category: Web

Local copy of WordPress Codex?

Sometimes I want to develop WordPress themes when I have no internet connection. I need the Function Reference and Template Tags to be productive. I searched for a downloadable or SVN copy of the Codex but could not find one. I ended up trying to mirror it using wget, but the results were spotty (it's too huge!). Is there a better way?
Category: Web

Is it possible to view WP documentation within the WordPress shell?

I'm having trouble navigating the WP documentation so forgive me if this is common knowledge. Is it possible to view the documentation of classes and methods from within the shell? That is, is there a command that I can type at the wp-shell prompt that will return the api documentation for a given method/class. Something like: doc(get_posts); #=> get_posts( array $args = null ) # Retrieves an array of the latest posts, or posts matching the given criteria. # Parameters …
Category: Web

How indicate when a functions was upgraded in relationship to the entire program

for inline documentation there are those @somethings for some php documenter, when there is the common @since @version and so on. I have a lot of functions that are all part of a big package. But what if i want to indicate when i last updated a function and show on what version of the mayor package it was done? should i just use @version and give the function the version of the entire package? In case i cause confusion: …
Category: Web

Check class_exists before class definition / Doxygen problem

Currently when I create a class for my WordPress, I start the class with if ( ! class_exist( 'class_i_want_create' ) ) : .... class_definition .... endif; But now I want to create a documentation with Doxygen. But Doxygen doesn't find the class when it's surrounded with the class_exist. So is it a bad practice when I don't surround it with the class_exist? Or does anybody know how I can configure Doxygen to see the class even when it's surrounded with …
Category: Web

Gutenberg & Pre-formatted Templates: Core Block Attributes

The Gutenberg Handbook currently has a short entry for creating whole templates of blocks, e.g. used for Custom Post Types or just pre-formatting posts. https://wordpress.org/gutenberg/handbook/templates/ It seems to be missing a comprehensive overview of the core/-blocks though. Especially the available attributes are interesting here. Is there a reference-entry I am just missing? To elaborate: By playing around, I found out a few things. E.g. preformatted blocks do take the formatting of a php file like line breaks, indends and tabs, …
Category: Web

Documentation for adding a tinyMCE view for visual live preview of custom shortcode?

I'm trying to add a WYSIWYG visual representation for a custom shortcode into the tinyMCE editor but I can barely find any information on how to do that. Researching the last few days resulted in almost zero or partial information. Why? I don't understand why such an amazing feature seems to not get any attention and support. This is the best info I could find: https://dtbaker.net/blog/web-development/2014/09/create-your-own-wordpress-tinymce-view-and-shortcode-popup-editor/ But it doesn't explain how to display the UI element as non-block content, so …
Category: Web

Will php documentation conflict with wordpress documentation?

Hi I have a php script that makes liberal use of /* */ // my question is will that conflict with wordpress since the wordpress engine often reads variables inside those things? The reason I ask is that to make a custom template, you just modify some text inside the documentation in the first part of the script /** * Template Name: Full Width Page * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ I worry …
Category: Web

Are the default entries for a user in wp_usermeta documented?

On a fresh vanilla install of wordpress users have default entries like nickename, first_name, last_name and so forth in wp_usermeta. I'm not sure if that changes often or at all but I can't seem to find any documentation what the default entries are. I would have expected it here: https://codex.wordpress.org/Database_Description#Table:_wp_usermeta Is the default set documented and where? Reason for asking: I'm building a plugin to replicate settings to other users but would like to exclude the default entries (or at …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.