The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

This may not be best practice, but you could select the css in a style sheet with .wp-caption { width: 100% !important; } this will override the in-line style.


0

Have you tried using: setImage: function( image_url, image_id ) { dispatch( 'core/editor' ).editPost( { meta: { 'og_image_url': image_url, 'og_image_id': image_id } } ); ...


0

The short answer is, you shouldn't. Post meta/etc store a single value, and to get around that some people PHP serialize the data. So much so that core started doing it automatically if you passed an array or object so that it could store a string. The problem is this opens you up to PHP serialisation attacks, and is a security concern. Additionally, it ...


0

You can be hacked by someone and they automatically post their content on your site. When I had my own site I faced the same problem and here I read an advice to change the password. Then it helped me, you can try.


0

The question is old, but there is a plugin for this purpose: https://wordpress.org/plugins/save-with-keyboard/


0

if you want to get all selected tag in "publish_post" try below code. it will give you selected tag from post. remove wp_die("all Tags"); after verify that you can get proper tags on publish post. add_action( 'publish_post', 'post_published_notification', 10, 2 ); function post_published_notification( $ID, $post ) { $all_tags = $_POST['tax_input']['...


1

Yes, that is doable. I don't know about running scripts immediately after WP installation is complete, but you could implement your idea perhaps with a must-use plugin. First you probably want some kind of way to get the contact page id. A helper function for that, function get_my_contact_page_id() { return get_option( 'my_contact_page', 0 ); // custom ...


0

This code will do it: global $post; $user = get_user_by( 'ID', $post->post_author ); if ( in_array( 'author', $user->roles ) ) {echo "Author";} You don't even need global $post; if you are if a query loop.


0

Hi Sir hope these can help: You need to check your database and see if the posts are really duplicated(maybe it is only visual duplicates for same posts), you will need to use a mysql client like phpmyadmin or similar solutions. you will check the wp_posts table. Post (content) data are not really in duplicates : (only one same post in the database) there's ...


-1

Try this using is_single and query_vars rather than is_page: add_action( 'pre_get_posts', 'change_queries', 1000 ); function change_queries ($query){ if(is_single() && $query->query_vars['page_id']== 'your page id'){ $query->set( 'cat', '3' ); } }


0

Most of the space in that table in your case is taken by the overhead. 919MB is full size, with 885MB of overhead. Overhead is caused by the storage and index write operations in the MyISAM database engine storage. You can run this query to clear overhead: OPTIMIZE TABLE `wpwn_posts` Or, you can convert all tables to InnoDB engine, it is the default MySQL ...


0

While I was typing up this question, I left it for a while, found out the problem, and decided to post the answer just in case it helped anyone else. Apparently, in WordPress's infinite wisdom, it decided to make this argument in its register_post_types function: 'publicly_queryable' When this is set to true, it causes this weird phenomenon. When it is ...


0

Thanks for the input, i solved the problem with the following workaround. strtotime($event_date)


0

Thanks @Basil, Your answer helped me, but instead of altering filters all I needed to do was add the capability "unfiltered_html" to the User Roles that were having this issue.


2

I'm not currently aware of other ways rather then: Creating an Instagram App Get an access token Build a small API handler Something like this to put in your functions.php: function my_instagram() { $transient_key = 'instagram_data'; $feed_data = get_transient( $transient_key ); if( false === $feed_data ) { $feed_data = json_decode(...


0

aslam shikalgar you misunderstood. I don't want to get all authors of comment blank. Only the author of the post which he's commenting.


0

I'd like to have a similar function on my web. This works fine for me, but as mentioned above, the Points value is still "100". I want to add "100" points arithmetically every time - so the next published post produces value 200 and so on. Could you help me to modify the function, please? function post_published_add_points( $ID, $post ) { // get author ...


0

Wordpress have "get_comment_author_url" function to retrieve the url of the author of the current comment. you can set it to blank using this function remove_author_url( $url, $id, $commentr ) { return ""; } add_filter( 'get_comment_author_url', 'remove_author_url', 10, 3);


0

As none of the currently existing plugins for this purpose supports WP5, a simple (but not great) solution is to use a new metabox. In your CPT's plugin: add_meta_box('pseudosticky', 'Is sticky', 'addbox', 'YOUR CUSTOM POST TYPE SLUG HERE', 'normal', 'high'); function addbox($post, $metabox) { $entered = get_post_meta($post->ID, 'pseudosticky', true);...


1

You're using get_next_post and get_previous_post correctly with get_permalink. The next and prev functions either return a WP_Post object or a falsy value. The permalink function accepts either a post object or a valid post ID and returns the post url as string, if it was found, otherwise it returns boolean false. I tested the code you've posted by copy-...


0

Why not. The API of WordPress has the function wp_delete_post to delete a post. If the trash is active, on default true, then this function moves the post to the trash. You need to add a logic after publishing a new post to delete the old one. To firte your function you should use the hook publish_post. So a simple starter see below, need the logic to get ...


0

I'd make a loop with 12 posts per page and after printing 4 posts I'd call another loop with 6 custom posts. Then go back and print the last 8 posts of current page. <?php $index = 1; $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $posts = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 12, 'paged' =&...


0

It should not affect it because Wordpress redirects links to post leaving you with only one canonical and working one. Post would be visible in both categories but will have only one correct permalink.


1

You can use Transients API See the example function calculatePostViews($postID){ $user_ip = $_SERVER['REMOTE_ADDR']; //retrieve the current IP address of the visitor $key = $user_ip . 'x' . $postID; //combine post ID & IP to form unique key $value = array($user_ip, $postID); // store post ID & IP as separate values (see note) $...


0

After few checking and testing, I figured the problem source and solved it myself, I'll share it here so anyone in future fall in the same problem, this can surely help. As I mentioned above the problem wasn't from the pagination at all, well the pagination got broken yes, but the thing that broke it is the WP_Query parameter offset because it overridden ...


Top 50 recent answers are included