I think the conditional tag which is comments_open() is not required. That checks if the comments are allowed for that specific page or not.
Try using the following code
<?php
if ( is_single('1740') ||
( !is_home() || !is_front_page() || !is_single() ) ) {
wp_enqueue_script( 'comment-reply' );
} ?>
comments_open() requires the post ID for the specific posts to check whether the comments are allowed or not. So avoid using the condition for that.
Don’t use is_singular() with ID as it checks if a singular post is being displayed using the post type name as a parameter. Instead use is_single() with using the post ID for which you wish to display.
In your above code, the flower bracket was missing too for the if condition.
Hope that helps the question you have asked.
Related Posts:
- Get only enqueued styles and scripts of the current theme
- Display user’s total comment count outside The Loop
- Facebook Comment Count
- Getting the comment number relative to all the post’s comments
- How to output a permanently delete comment link?
- count number of user comments with a specific comment meta value
- Trigger a php file on every post or page if a condition is met
- Change comments form title on a page by page basis
- Enqueue less file not working in child theme?
- How do I make wordpress comment fields required?
- Execute only on a certain page
- How to execute a simple php script in WP (I don’t think wp_enque_script applies here)
- How to check if comments are paginated?
- Notify WordPress Site I Have Linked To Them
- Add “last” and “first” to WordPress Comment Pagination Links
- enqueue hover function
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- Replace comment avatars and links at the same time
- Adding ads code between comments
- How to enqueue CSS and JS only on specific template?
- How do I fetch all comments per post via WP REST API?
- Deregistering a script in WordPress seems impossible
- comments_number display outside specified span
- Trying to implement Ajax comments in WordPress, getting WP error
- “comments.php” not available after edit in WP administration
- User’s total comment count excluding comments on their own posts
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Show wp_die if url form comment not emply
- How to inject variables into public-facing JS using wp_enqueue_script
- Why does my callback function not work with this custom filter hook?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- How to only enqueue script if it’s a post
- How to implement a rating and review system for WordPress custom posts?
- Ajax load more button for comments wordpress
- Limit 1 global comment per minute
- Create Page To Count Comments For Each Post In WordPress Site
- comments sorting incorrectly across multiple pages
- Commenting out unwated CSS/scripts in HTML with PHP
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- WordPress Scripts Being Loaded in Footer
- Genesis framework comments broken?
- check if comment submitted was successful
- Jquery function working in Dev Console but not otherwise [duplicate]
- Alter required message using comment form api
- Get post id within comments loop
- Is the wp_enqueue method efficient?
- Correct way to enqueue page specific CSS file
- WordPress comment submit button substitutes/options
- linking stylesheets and scripts with functions.php
- Double jQuery loaded
- Does anyone know all parameters of get_comments()
- get comment data using comment id
- Removing the comment function within wordpress
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- How to use wordpress function wp_enqueue_script() in php?
- Enqueing External JS on the remote server JS
- Trying to enqueue script – Nothing Happens
- Fetching Initials of the Commentator in the WordPress Website
- get_comments_number() returns 0
- url_to_postid returns 0
- How can I include the user id inside of a shortcode php output?
- Restrict characters in comment section
- Conditionally load class in the comment section of the post page
- How to get comment_ID by post_ID in wordpress
- Enqueueing a code block from an options framework
- Comment_author_url doing nothing
- Fatal error: Cannot redeclare comment_theme()
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- Show all people who commented on all posts by an author
- Using Google Analytics in an enqueued JS file
- Commenting requires wordpress login, wordpress discussion and post comments tick boxes are checked
- How to change order inside foreach using wp_enqueue_script?
- Comments on my custom post type
- Fetch commens from a specific post
- Enqueue sripts and styles only if function is called
- Load script and styles using an array of resources
- Closing Comments conditionally in comments.php
- When to use wp_register_script() function?
- How to stop loading my custom scripts files for wordpress iframe?
- Real time notification on user profile after new comment
- How can I output the slug of a comment author?
- Chosen Select jquery Not Working in Plugin
- WordPress – show number of comments for each post in widget
- How does add_action ‘comment_post’ work?
- Custom action on comment post
- WordPress most commented posts of last X days
- How do I call comments_template(); from a plugin file?
- Trouble figuring out how to get my button to submit comment
- Errors while Loading Most Recent Version of jQuery
- Warning: filemtime(): stat failed for wp_
- How to enqueue structured data as file – jsonld file seems not to work
- Make a variable global and use it for inline script
- Guests comment form – prevent duplicate email addresses
- functions.php doesn’t load all custom theme assets
- Permissions error when I use my plugin to delete comments in the front-end
- Pre_get_comments and orderby comment_karma
- Remove links to the comments section