WordPress 404 when using AJAX to call php function

When I was new to WP and PHP, a revelation occurred when I realized what PHP stands for. “PHP Hypertext Preprocessor.” Sure, the recursive acronym is cool, but the “preprocessor” was what rung my bell. In other words, when a page is served, the PHP runs first, generating HTML, which is then interpreted by the … Read more

Latest Post Thumbnail Alt Text Missing

You need to define $image_alt and $image_title. I don’t see where you did it in your code. You need to change/add like this <?php if ( has_post_thumbnail() ) { $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),’thumbnail’ ); $attachment_meta = get_post(get_post_thumbnail_id()); echo ‘<img width=”100%” src=”‘.$image_src[0].'” alt=”‘.$attachment_meta->post_excerpt.'” title=”‘.$attachment_meta->post_title.'”>’; } else { ?> <img src=”<?php bloginfo(‘template_directory’); ?>/img/fallback.jpg” class=”img-responsive” /> <?php } … Read more

Ajax not updating to database

To test your AJAX is working add_action( ‘wp_ajax_editCommittee’, ‘test_ajax_request’ ); add_action( ‘wp_ajax_nopriv_editCommittee’, ‘test_ajax_request’ ); function test_ajax_request() { echo “Request: ” . PHP_EOL; var_dump( $_REQUEST ); exit; } And update your request to move the action into the data sent: jQuery (document).ready (function($) { $ (“.edit_tr”).click (function() { var commitID = $ (this).attr (‘id’); // on … Read more

truncating imported rss-feeds

Use PHP string functions like substr to return a number of characters rather than word count. The post content aaaaaaaaaaaaaaa aaaaaaaaaaaaa will be much longer than a a. $max_length = 150; echo substr( $string, 0, $max_length ); As a function it might look like: function string_limit_words( $string = ”, $count = 25, $after=”…” ) { … Read more

woocommerce plugin bugs

You need to correct how you call function in your class, if the function you want to use is in the class, for the add_action: add_action( ‘woocommerce_account_wallet-endpoint’, array($this, ‘displayWallet’) ); add_action( ‘wp_login’, array($this, ‘walletOwner’), 99); Replace all add_action or filter like this.