How do I fix the 403 error for wp-admin/admin-ajax.php?

When I use the Safari console, I always get the following notification: failed to load the resource: the server responded with a status of 403 for wp-admin/admin-ajax.php Does anyone know how to fix this? I've already checked the file permissions. These work out fine so far.
Category: Web

admin-post.php results on white screen after form submission

This is a strange error because it wasn't happening earlier, it was actually all working fine. I have removed all the code I have added since I last tested it and it was working before it broke. I have a custom post acting as a page to submit a form on and I am processing the form via a function in the functions.php page in my plugin. function tm_add_new_job() { if ( empty($_POST) || !wp_verify_nonce($_POST['tm_add_new_job'],'tm_add_new_job') ) { wp_nonce_ays(); die(); } …
Category: Web

Database issue?

I installed WordPress from a zip file via FTP, followed the install procedure exactly - When accessing the URL, all I could see is a default page without opening any install script. I then manually entered https://"mysite".com/wp-login.php and it opened a login window. I entered the username and PW I created in wp-config.php - I was advised no such user- double checked everything and found no errors I could determine. I'm guessing that the problem is something in either database …
Category: Web

How to Use JSON With AJAX?

I've defined a PHP callback function to handle the communication between server-side and client-side: function json_render_modal_body() { check_ajax_referer( THEME_PREFIX . '-modals', 'nonce' ); $response = array( 'text' => 'no' ); $modal_id = null; if ( isset( $_GET['modal_id'] ) && ! $modal_id = filter_var( $_GET['modal_id'], FILTER_SANITIZE_STRING ) ) { wp_send_json_error( $response ); } if ( ! $form = render_form( $modal_id ) ) { wp_send_json_error( $response ); } $response['text'] = 'yes'; wp_send_json_success( $response ); } I've told WordPress about this function, to …
Category: Web

How to replace username with email address in users table

I have a custom built site that does not use usernames and everything requires use of their email address. The username is auto generated and looks bad in the table. I know there are filters and actions to work with custom columns within the users table but I have been looking for a way to replace the username with the email address. I know I can unset the username using manage_users_columns filter but I then loose the row actions. Is …
Category: Web

How to add Extra Column of post Status in All post page

how can I add an extra admin column with the Status of posts like Below Image. i know admin column plugin for this work but i don't want to use any plugin..so please suggest me if there any code to add an extra admin column with the Post Status
Category: Web

add_submenu_page() issue

I am trying to add a Menu in WordPress Admin Panel. I am using below code. This code is working. add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', [$this, 'weathers']); But below code is not working. I am facing error Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'edit.php?post_type=weather' not found or invalid function name . add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', 'edit.php?post_type=weather');
Category: Web

Customize a WP_Posts_List_Table class

How can I customize output of tables of records in wp-admin/edit.php? What options are available for editing display_tablenav('top') and display_tablenav('bottom') before outputting in class WP_Posts_List_Table? I would like to insert my block between the table where records are displayed and the filters, for example: <h3>Titlle</h3>. No matter what. The Codex is written: This class's access is marked as private. That means it is not intended for use by plugin and theme developers, but only by other core functions and classes. …
Category: Web

Impossible to create a new WooCommerce customer using Rest API

On my website I have created a register page in react and I am using Wordpress headless with WooCommerce on it. So I was expecting to create a new user using the register page i have and as the Wordpress side is by default set to create a 'Customer" user type for any new registration. The registration is partially working. Let me explaining. To achieve the registration I have done this: On wordpress, I have installed the plugin : WP …
Category: Web

display dynamic WP Site logo on wp-admin using CSS

I'm looking for a way to always display the current site logo (as set in customiser) on the wp-admin page in place of the WP logo via CSS. I know how to manually add a custom image (code below is part of the function I use): #login h1 a, .login h1 a { background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png); background-size: contain; But I would like to make the entire URL dynamic, so the site logo can be changed in the customiser …
Category: Web

Cached php? Updates are rendering only if logged as admin

I was asked to fix a wordpress based site and I don't get what's going on with it. The (custom) theme has a page-home.php that is the Home page. Whatever edits I make to this file, if I refresh the page logged in wp-admin (so, I'm an admin), the change is seen, but logged out (anonymous - as the site is intended to be used) it's still the old content. I did the following: downloaded all site locally, opened all …
Category: Web

What are the standard admin CSS id/class tags?

Is there a list of WordPress CSS id/classes that I can use to build plugin option screens that look and feel more like a normal WordPress option page? I have found some through serendipity but it would have been nice to have a list. An example is this class: button-primary That makes a button look like this:
Category: Web

manage_edit-{post_type}_sortable_columns sorts, but wrong!

Good afternoon! This is an issue regarding the Wordpress backend and custom post types. I have spent all Friday searching and trying possible solutions and, while they helped others, in my case they're not doing what I need. Status quo I have a custom post type called "anco_project" it uses very few WP given data-fields but more custom ones from the ACF addon including a field called "anco_project_year_from" and one called "anco_project_year_to", both set up as a 'true number' format. …
Category: Web

OSX El Capitan local install Maximum upload file size: 2 MB But php.ini set to 64M

Brand new site. Not MU. No matter what I do, I cannot get a file uploaded that exceeds 2MB. I'm running a localhost server with WordPress 4.3.1 I've modified both relevant settings in the the site's php.ini as: upload_max_filesize = 64M post_max_size = 64M However, I'm still getting the message when trying to upload a plugin that's 2.5M The uploaded file exceeds the upload_max_filesize directive in php.ini. Also, when I go to "Media > Add New", I get the message: …
Category: Web

Linking table cells to network folders

Is it possible to create links to a network folder from within a table? A colleague and myself have been struggling to link certain table cells to a network folder, for example: DB - Database would be linked to a network folder of the same name. What we have tried: Using <a href="http://\\networkdrive\folder1\folder2\folder3\DB - Databases">DB - Databases</a> returns a 'Sorry, the page was not found' error from our storage device Using <a href="file:///path/to/file.html">file</a> did not open the desired folder location …
Category: Web

Speed up / Optimize Admin Edit Post Page on Large Websites (50-150k posts, 50 custom fields per post)

I'm working with a set of large Wordpress installs with 50-150k posts, each with 40-50 custom fields. The installs are very basic, with limited plugins (less than 5), and a default Wordpress theme (i.e. twenty twelve, etc.). The sites are on 1-Core, 2GB RAM, SSD VPS servers. These are all private installs, with no public front-end or web traffic. Automatic updater, auto-update core, and revisions are all disabled. I have no featured images or other media on the edit post …
Category: Web

How can I trigger a javascript function after a post update on edit post screen in wordpress admin panel?

I use Wordpress 5.2.2 and I develop a custom theme. EDIT : On my theme I added a metabox who show an input type="text". Code in functions.php of my theme if ( ! function_exists( 'vn_add_metabox' ) ) { function vn_add_metabox () { add_meta_box('vn_youtube_single_metabox', __('Youtube link', WP_THEME_TEXTDOMAIN), 'show_vn_youtube_link_metabox', array('post', 'page'), 'side', 'low'); } add_action( 'add_meta_boxes', 'vn_add_metabox' ); } This metabox call show_vn_youtube_link_metabox who display an input text and youtube video iframe if (!function_exists('show_vn_youtube_link_metabox')) { function show_vn_youtube_link_metabox() { global $post; show_vn_input_text('vn_youtube_link'); // …
Category: Web

wordpress plugin translation not working

I have no idea what is wrong here. First I would like to share probably all required info. Plugin tree: $ tree . ├── classes │ ├── database │ │ ├── plugin-auth.php │ │ ├── plugin-user.php │ │ └── wp-user-x.php │ ├── main │ │ └── plugin.php │ └── woocommerce │ └── plugin-order.php ├── config.php ├── plugin.php ├── languages │ ├── plugin-shop-en_US.mo │ ├── plugin-shop-en_US.po │ ├── plugin-shop-pl_PL.mo │ └── plugin-shop-pl_PL.po └── templates └── register.php plugin.php contains Text Domain: plugin-shop …
Category: Web

About

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