Store admin page into variable

In case something like this would ever need to somebody, I solved pinging the page with an AJAX request $.ajax({ url: ‘your_url_to_ping’, beforeSend: function(xhr) { //something } }).done(function(data) { //something else with your data }); The page would be into your response data.

WordPress ajax error 400 bad request for sending data to remote site [duplicate]

Your action name and hooks don’t match. You have hooked to _ajax_news in the hook name: add_action( ‘wp_ajax_nopriv_ajax_news’, ‘ajax_news’ ); add_action( ‘wp_ajax_ajax_news’, ‘ajax_news’ ); But the action you are sending in JavaScript is ajaxnews, without the underscore: ‘action’: ‘ajaxnews’, //calls wp_ajax_nopriv_ajaxnews See how your own comment has a different name than the actual hooks you’ve … Read more

Cannot modify header information – headers already sent during plugin activation

Since the standard redirection works, I figured the conflict must be with TGM plugin activation already hooking to activated_plugin and producing output and thus preventing the redirect… Therefore the solution was to ensure that the plugin activation function hook was added to an earlier priority than the (silent) default of 10 most probably used by … Read more

WP nonce verification

If this is coming from a form you can use this code to add the nonce to it: // Create an nonce, and add it as a query var in a link to perform an action. $nonce = wp_create_nonce( ‘my-nonce’ ); <form action=’youraction?_wpnonce=<?php echo $nonce?>’> <!– Form Contents –> </form> Then you can add this … Read more

WordPress drop domain alias

If you are NOT using WordPress MultiSite add the following in wp-config.php. define( ‘WP_HOME’, ‘http://klenotnictvi-benesov.cz’ ); define( ‘WP_SITEURL’, ‘http://klenotnictvi-benesov.cz’ ); If you ARE using WordPress MultiSite you will need to access the database directly and edit the wp_options table and change “siteurl” & “home” to the correct url. Here is more info on changing the … Read more