Can’t get post ID using wp_insert_post_data
From the codex page You must pass 2 for the $accepted_args variable in add_filter() if you want to access $postarr. So use this: add_filter( ‘wp_insert_post_data’, ‘set_post_title’, 99, 2 );
From the codex page You must pass 2 for the $accepted_args variable in add_filter() if you want to access $postarr. So use this: add_filter( ‘wp_insert_post_data’, ‘set_post_title’, 99, 2 );
I assume that you want to add more custom fields in widget back end form, for this you just need to create a new field in form( $instance ); function. So the code will look like // Widget Backend public function form( $instance ) { if ( isset( $instance[ ‘title’ ] ) ) { $title … Read more
Try logging out of the site and going to /wp-admin (to get to the login screen). Click on the Forgot Password link and enter your username. Did you get an email with password reset instructions? If not, that means that the email configuration (as Emetrop has suggested) may not be correct for the server.
As you may or may not know any post meta data is stored in a new table, $wpdb->postmeta. This table has four fields: ‘meta_id’ – A unique id for each entry. ‘post_id’ – The ID of the post for this metadata. ‘meta_key’ – The name of the ‘key’. ‘meta_value’ – The value associated with the … Read more
So you don’t need to create those fields, that why they are called Meta fields because they don’t require any setup for them. I’ve improved the code and made sure it was working, applied a few good practices here and there, and added a few comments. function custom_user_profile_fields( $user = null ) { global $wpdb; … Read more
Please check whether you have used select box name attribute as an array. Example: <select name=”data[]” multiple=”multiple”></select> Please try above code and let me know if still problem persists.
While you can’t edit the dropdown list, you can achieve what you want as long as you are able to edit your theme or if your theme uses the standard the_author() template tag. To recast your question, you want: Editor’s names to show as Name + nickname + surname Other names to show as nickname … Read more
To begin with you may need to add %s to the sprintf function, as the current link has no anchor text and this is supposed to be put in by sprintf as the second argument: return sprintf( ‘<div class=”form-block block-after-indent”><a class=”atbtn atbtn–secondary1″ href=”#sime_url_product_id_%d”>%s</a></div>’, $product->id, esc_html( $product->get_title() ) );
Using a variable will make your code a little less repetitive: $case_history_code = get_field( ‘case-history-code’ ); if ( $case_history_code ) { // make the code lowercase $case_history_code_lower = strtolower( $case_history_code ); // use the lowercase inside of `get_posts` $myposts = get_posts( ‘numberposts=3&offset=0&category_name=” . $case_history_code_lower ); foreach ($myposts as $post) : setup_postdata($post); ?> <a href=”https://wordpress.stackexchange.com/questions/220489/<?php the_permalink(); … Read more
You can use current_user_can() and is_user_logged_in() to validate current user: <?php if ( is_user_logged_in() && current_user_can(‘role’) ) : ?> <span style=”font-size:16px”> <strong>Currently reading:</strong> <?php the_field(‘book_name’); ?> (<?php the_field(‘book_year’); ?>)<br/> <strong>Currently seeing:</strong> <?php the_field(‘movie_name’); ?>”><br/> </span> <?php endif; ?> Make sure to change role to your preference and take a look at Codex for more info.