Skip to content

Instantly share code, notes, and snippets.

View nextab's full-sized avatar

nexTab - Oliver Gehrmann nextab

View GitHub Profile
@Crocoblock
Crocoblock / jet-engine-get-query.md
Last active April 7, 2024 02:16
JetEngine Get query by ID, get items from query

Call these methods not earlier than on 'init' with the priority of 12, queries are not registered before that

Get query list

Returns an array of $id => $name

$queries = \Jet_Engine\Query_Builder\Manager::instance()->get_queries_for_options()

Get query by ID

ID is an integer, can be found in query URL in Query Builder; \

@Crocoblock
Crocoblock / macro-example.php
Last active June 22, 2024 20:42
Add custom macro for JetEngine. Example - get the current user property, such as ID, user_email, etc.
<?php
/**
* Note!
* Register macros on jet-engine/register-macros action only,
* as the base macro class \Jet_Engine_Base_Macros is not available before that action;
* after it - all macros are registered already
*/
add_action( 'jet-engine/register-macros', function(){
@nickalexej
nickalexej / function.php
Created January 31, 2021 18:44 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}