Hot answers tagged

2

First of all, in your jquery event handler the action parameter's value should be the string after wp_ajax_ and wp_ajax_nopriv_. So in your example the action should be update_records. So display_func is wrong. Then in line 3 of your php code here the echo keyword should be removed. So your php code should be like this: function update_records(){ global $...


1

Searching for .notice on WP source code I found the culprit at wp-admin/js/common.js: $( 'div.updated, div.error, div.notice' ).not( '.inline, .below-h2' ).insertAfter( $headerEnd ); Adding an inline class to my code solves the issue: <div class="notice updated inline">Form sent</div>


1

I see that there's an internal server error (see screenshot) when you tried to update a record in the database, and the error is likely because you incorrectly called $wpdb->update() which has the syntax of — and note that the first three parameters ($table, $data and $where) are required: wpdb::update( string $table, array $data, array $where, array|...


1

I want the URLs of the nav-items to be replaced with # You can use the nav_menu_link_attributes hook to set the custom href value like so: add_filter( 'nav_menu_link_attributes', function ( $atts, $item, $args ) { if ( 'menu-categorias' === $args->theme_location && 'category' === $item->object ) { $atts['href'] = '#' . ...


1

/* Show/Hide my div*/ jQuery(document).on('click','.my-button',function() { //jQuery('.div-wordpress').slideToggle('230','swing','hide'); this.remove();//supposed to be #my-button ? }); Note that I have swapped ids for classes and just made a small JS update - this is the clicked element inside a jQuery event - not jQuery(this) Here is a CodePen: ...


1

Special thanks are offered to @Pat J. The problem was actually with the jQuery code I had written. jQuery(document).ready(function() { // Some Code Goes Here... }) Just take a look at the complete segment: public function doSomethingSpecific() { ?> <script type="text/javascript" > ...


1

In PHP, it's not necessary to post to a PHP file, it is only required to include ( or require ) files and then use checks and validations to ensure that code is only processed when required. You simply need to include the PHP file as part of your application - it will process the PHP is the conditions are met.


Only top voted, non community-wiki answers of a minimum length are eligible