To create an admin user without database access you can use this code.
to use
create a file containing the code e.g. tempadmin.php
change the values of username, password and email
upload to wp-content/mu-plugins directory
| <?php | |
| /** | |
| * Plugin Name: Add IDs to body tag for Genesis | |
| * Plugin URI: https://fullworks.net/products/custom-plugin-development/ | |
| * Description: Add IDs to body tag | |
| * Version: 1.0.0 | |
| * Author: Alan Fuller | |
| * Author URI: https://fullworks.net/products/custom-plugin-development/ | |
| * License: GPL-2.0+ | |
| */ |
| <html> | |
| <head> | |
| <title></title> | |
| <meta content=""> | |
| <style></style> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
| <script> | |
| (function( $ ) { | |
| 'use strict'; | |
| $.ajax({ |
| add_filter( 'gform_entry_is_spam', funtion($is_spam, $form, $entry) { | |
| if ( in_whitelist() ) { // in white list is your own rules | |
| return false; | |
| } | |
| return $is_spam; | |
| }, 10, // might need to play with priority if using Akismet integration so it checks after Akismet | |
| 3 ); |
| add_action( 'init', function () { | |
| register_post_type( 'cpttop', array( | |
| 'labels' => array( | |
| 'name' => 'Top CPT', | |
| 'singular_name' => 'Top CPT', | |
| ), | |
| 'show_ui' => true | |
| ) ); | |
| } ); | |
| add_action( 'init', function () { |
| add_filter( 'register_post_type_args', function ( $args, $post_type ) { | |
| if ( $post_type == "sub" ) { | |
| $args['show_in_menu'] = 'edit.php?post_type=top'; | |
| $args['labels']['all_items'] = __( 'All Sub Items', 'my-text-domain' ); | |
| } | |
| return $args; | |
| }, 11, 2 ); |
| add_action( 'template_redirect', function() { | |
| if ( is_author('nickname') ) { // change either nickname or user id see https://codex.wordpress.org/Function_Reference/is_author | |
| status_header( 404 ); | |
| get_template_part( 404 ); | |
| exit(); | |
| } | |
| }); |
To create an admin user without database access you can use this code.
to use
create a file containing the code e.g. tempadmin.php
change the values of username, password and email
upload to wp-content/mu-plugins directory
| find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r |
| <?php | |
| $result = my_api_func( 'https:api....', array( 'arg1' => 'value1' ), true ); | |
| if ( is_wp_error( $result ) ) { | |
| // error | |
| } | |
| /** | |
| * @param $url | |
| * @param array $args | |
| * @param bool $json_decode |
| <?php | |
| /** | |
| * | |
| * Plugin Name: Custom Code | |
| * Plugin URI: https://fullworks.net/products/custom-plugin-development/ | |
| * Description: Custom Code | |
| * Version: 0.0.0 | |
| * Author: Fullworks | |
| * Author URI: http://fullworks.net/ | |
| * License: GPL-3.0+ |