Ajax call to php function doesn’t work PHP code

It looks like the MBAjax.ajaxurl and MBAjax.admin_url are probably not set. If it can’t post to the correct WordPress handler, then you will probably get a 404 page HTML returned instead of the PHP function return value. You can test by hard-coding the ajax url to url: “/wp-admin/admin-ajax.php”, and see if that fixes things. Secondly, … Read more

How to submit custom form data using ajax to HubSpot form?

You can’t do it easily. You can send AJAX requests only to the same server your site is on. To send such request to another server, you’ll have to use CORS (https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). And I don’t believe that HubSpot will allow you to set proper headers…

Can’t activate and deactivate plugins

First always take a full backup of your site and database before doing anything. Via FTP rename your Plugins folder to “Plugins_bak” and make another Plugins folder. Then go to WordPress dashboard try installing any plugin and see if you can activate – deactivate them. If this works then there must be an issue with … Read more

Return function results within shortcode

This is correct (I just had file versioning issues): <?php function say_sup(){ return ‘sup’; } add_shortcode( ‘sup_shortcode’, ‘register_sup_shortcode’ ); function register_sup_shortcode( $atts, $content = null) { $sup = say_sup(); return $sup; } ?> This is not correct – and there would be little purpose in trying to make something like this work, if the above … Read more