Try this, where I changed the function to accept the second parameter which is the current post in the list table:
add_filter( 'post_row_actions', 'remove_row_actions', 10, 2 );
function remove_row_actions( $actions, $post )
{
if ( $post && 'post' === $post->post_type &&
in_array( $post->post_status, array( 'publish', 'pending' ) )
) {
unset( $actions['edit'] );
}
return $actions;
}
Related Posts:
- Upload Multiple Files With media_handle_upload
- What is this code in my theme’s functions.php? if (isset($_REQUEST[‘action’]) && isset($_REQUEST[‘password’])
- VERY new to coding – keep breaking site trying to add to functions.php
- Problem with tag
- write in functions.php
- Pinterest Integration Using functions.php
- Date/time limitation of posts where function must be executed
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- How can this crude function be improved?
- How to run a function in every page, every device
- How i can put $_GET codes in function.php?
- Numbering lines of code with the tag?
- Save Meta when custom Taxonomy Saves
- Adding a schema code to one specific page using functions.php file
- How set a while with a function
- Drop down list code for sidebar
- Some code is added automatically to my site’s header – what is it?
- How to include a hyperlink in the body text of a custom password protected form?
- How to get tags and categories?
- How to add a class name to the ancestor of a post?
- Code in functions.php appearing on front-end and dashboard [closed]
- I want to add the alt attribute to all the photos!
- Bad value crossorigin for attribute crossorigin on element link
- Text before price on WooCom
- Convert Image to Webp on upload without plugin
- What’s the difference between WordPress random_int() and PHP built-in function random_int()?
- Is it ok to use a function to output the text domain name in a wordpress theme
- Issue with wp_get_attachment_image() and SVG file type
- deregister scripts on certain page
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Using get_terms for custom taxonomy in functions.php
- How to remove the embed_footer?
- Add footer.php to WordPress child theme
- Hide some items from Screen options in dashboard for products
- Editing or filtering the output of the Genesis navigation
- Using the child theme functions.php to change the customizer.php on parent theme
- Can’t Update function.php after writing short code
- How to get last updated row or ID in wordpress
- edit role display name and label name without plugins
- is_plugin_active() not properly returning true
- Display gallery on top before content
- List of Body Classes Generated by body_class()
- wp_dropdown_categories and custom attribute
- Converting html to wordpress images not showing
- Redirect specific page in WordPress for first time visit
- How can I add text to all posts/pages/categories/homepage etc
- Related post using post title
- Move Post to different category if post_meta field is 0 or is 2 days old?
- Excerpts are not displayed by a shortcode on category pages
- Getting comment count per post not working
- Functions.php Problem
- It does not work concatenation in function.php
- Is There Any Built In WP Functionality For Combining Form Fields To Return Specific Data
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Condition OR for current user ID
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- If user is logged-in display/hide something
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- Adding javascript to functions.php causes problems with my template
- Where do I store custom functions that call custom page template files?
- Excerpt for pages not showing
- How can I add a class to a nav li depending on URL?
- Access category within rss2_head hook?
- How to Extend login session times to a Month
- Modifying the_posts_pagination from within functions.php instead of template files
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- Prevent WordPress Automatic Logout
- functions php file [closed]
- How to add array [closed]
- How add body_class from wp_termmeta
- remove_action not working, even after changing priority [duplicate]
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- Modify function to only return values for the user that’s logged in
- WordPress performance – send all metaboxes to function or to call it again
- Add a class to post if it has been recently updated
- Change custom featured image size in twentythirteen child theme
- Theme Customizer – Custom Sections Display, but do Nothing
- WordPress comment processing . Default unapproved comments detection before posting
- Display a list of random terms from custom taxonomy with shortcode
- Login cookies blocked after customizing hashing method
- Class parameter in get_avatar args doesn’t get added to output
- Remove text after a dot and a colon in Woocommerce product title
- Enable CORS Request for hostname using IP address
- How to use `foreach()` in ajax call
- Change default color scheme in twentyfifteen child theme?
- Restrict access if logged out except for homepage
- Add meta data in head from theme
- DISABLE wordpress upgrade page
- How to echo the translated custom field?
- How to list out all values from the get_body_class array
- Moving CDN jQuery to footer does not work?
- Function not recognizing page id?
- Register a widget area when a theme option has been saved?
- Blank child theme – functions.php problem
- Pull random comment from specific post, display on homepage with shortcode
- Hiding Google Analytics code based on theme options
- How do I make my child theme’s CSS update when I save it?
- Customizer cuistom CSS Priority ordre Issue
- WPDB query suddenly not working