WordPress Developer Ukraine, Kyiv
WordPress WP_Rewrite: Custom Permalink Structures, Rewrite Rules, and Flush Rules Correctly

WordPress WP_Rewrite: Custom Permalink Structures, Rewrite Rules, and Fl ...

Rewrite rules in WordPress: custom post type slugs, endpoints and flushing WordPress turns pretty URLs into queries with a table of rewrite rules: regular expressions that map a path like /books/my-book/ to query variables like post_type=book&name=my-book. The table is generated by the WP_Rewrite class and stored in the rewrite_rules option. Custom post types, taxonomies and…
WordPress Array Helpers: wp_list_pluck, wp_list_filter, and wp_list_sort for Object Arrays

WordPress Array Helpers: wp_list_pluck, wp_list_filter, and wp_list_sort ...

wp_list_pluck(), wp_list_filter() and wp_list_sort(): array helpers in WordPress WordPress returns lists everywhere: get_posts() gives WP_Post objects, get_terms() gives WP_Term objects, get_users() gives WP_User objects. Getting one field from all of them, keeping some of them or sorting them by a field are everyday tasks, and core has three small functions for them that work with…
WordPress Path and URL Constants: plugin_dir_path, get_template_directory, home_url Reference

WordPress Path and URL Constants: plugin_dir_path, get_template_director ...

Paths and URLs in WordPress: plugin_dir_path(), get_stylesheet_directory() and friends A plugin or theme needs two kinds of locations: file system paths for PHP (require, file_exists(), reading files) and URLs for the browser (stylesheets, scripts, images, links). Mixing them up, or hard-coding /wp-content/, is a typical source of bugs that appear only on another server, with…